/* $Header: methlist.c,v 2.2 01/10/02 10:32:10 przybyls Exp $ */

/************************************************************************
**      File: methlist.c
**
**      Author: John DeGood
**
**      Contents: Method list functions.
**
**      Copyright (c) 1994 Hewlett-Packard Co.
************************************************************************/

/*
** There are 4 public functions used to access the formatted method listing:
**
**    RewindMethodFmt - rewind to beginning of method listing
**    RewindSamplerFmt - rewind to beginning of ALS listing
**    ReadMethodFmt - format a method listing line, return length or -1 if EOF
**    ReadSamplerFmt - format an ALS listing line, return length or -1 if EOF
**
** The listing generation process is table-driven by 2 levels of tables.  The
** first level is of type ML_PAGE, and it defines the major sections that
** appear in the left and right columns of the 2-column list format.  The
** second level is of type ML_SECTION, and each entry consists of a function
** and an optional pointer for generating one listing line.  Each of these
** functions is of type ML_PRINT_RESULT and returns one of the following:
**
**    ML_PRINT - a line was printed, and this function is complete
**    ML_NO_PRINT - a line was not printed, and this function is complete
**    ML_PRINT_LOOP - a line was printed, and this function is not complete
**    ML_NO_PRINT_LOOP - a line was not printed, and this function is not complete
*/

#include <typedefs.h>
#include <i_op.h>
#include <string.h>
#include <messages.h>
#include <p_wkfile.h>
#include <wkfile.h>
#include <ramps.h>
#include <zone_config.h>
#include <zone_status.h>
#include <p_status.h>
#include <status.h>
#include <display.h>
#include <error.h>
#include <zone_ui.h>
#include <clock_ui.h>
#include <keyboard.h>
#include <als_ui.h>
#include <p_ui.h>
#include <det_ui.h>
#include <sig_types.h>
#include <sig_ui.h>
#include <method.h>
#include <exception.h>
#include <timetable.h>
#include <valve_ui.h>

/************************************************************************/

/*
** INET Integrator Print/Plot Line Lengths:
**
**      42    - 3392A, 3393A (HP-85 "toilet paper" mech)
**      80    - 3396A        (HP 2225 ThinkJet mech)
**      70/80 - 3396B, 3396C (HP 2225 ThinkJet mech)
**
** We have chosen to forego compatibility with the "toilet paper" integrators.
** On the wide paper integrators we cannot save/restore line length mode, so
** we must choose the least common denominator and generate our listings for
** 70 column lines.  We use the format:
**
**      <34 char column><2 char whitespace><34 char column>
**
** Things like bold, underline, and foreign language character sets don't
** work well with the integrator print/plot, so we don't use them.
*/

/************************************************************************/

/* macros */
#define COL_WIDTH       34      /* width of left and right listing column */
#define COL_GAP         2       /* gap between left and right listing columns */
#define COL_INDENT      3       /* amount to indent non-heading lines */
#define MIN_FILL        2       /* minimum fill space between ALS identifier and value */

/* typedefs */

typedef enum { ML_NO_PRINT, ML_PRINT, ML_NO_PRINT_LOOP, ML_PRINT_LOOP } ML_PRINT_RESULT;

typedef struct
{
        ML_PRINT_RESULT (* line)(BIT8 *s, U_INT8 index, void *param);
        void *param;
} ML_SECTION_ENTRY;

typedef ML_SECTION_ENTRY ML_SECTION[];

typedef struct
{
        const ML_SECTION_ENTRY * (* left)(void);
        const ML_SECTION_ENTRY * (* right)(void);
} ML_PAGE_ENTRY;

typedef ML_PAGE_ENTRY ML_PAGE[];

typedef struct
{
        const ML_PAGE *page;
        U_INT8 pageIndex;
        U_INT8 leftIndex;
        U_INT8 rightIndex;
        const ML_SECTION_ENTRY *left;
        const ML_SECTION_ENTRY *right;
} ML_STATE;

/* static variables */
static ML_STATE ALS[2];
static ML_STATE GC[2];
static BIT8 tmpStr[COL_WIDTH + 1];  /* this doesn't need to be static:  we put it here to keep it out of the stack frames */

/************************************************************************/

/* cncat - append n copies of char c onto string s */
static void cncat(BIT8 *s, char c, size_t n)
{
        BIT8 *p;
        U_INT16 i;

        /* find end of string */
        p = s + strlen((char *)s);

        /* append chars on string end */
        for (i = 0; i < n; i++)
        {
                *(p + i) = (BIT8)c;
        }

        /* append NULL */
        *(p + n) = (BIT8)'\0';
}

/************************************************************************/

/* ExpandString - copies in string to out string, expanding it to width:
**
** +---------- width ----------+
** |                           |
** v                           v
** <indent><id>" "<fill>" "<val>
**
** If singleValue == TRUE then the value part is a single word.
** If singleValue == FALSE then the id part is a single word.
**
** Note:  Leading and trailing blanks are removed.  The id and val fields are
**        separated by the last embedded sequence of blanks in the in string.
**        Underscore characters are replaced by blanks.
*/
void ExpandString(BIT8 *in, BIT8 *out, U_INT8 width, U_INT8 indent, BIT8 fillChar, BIT8 singleValue)
{
        size_t inLen, idLen, valLen;
        INT16 fill;
        BIT8 *id, *val, *idEnd, *valEnd, *p;

        /* init out string */
        *out = '\0';

        /* work forward to eliminate leading blanks and find start of id substring */
        inLen = strlen((char *)in);
        for (id = in; id < (in + inLen); id++)
        {
                if ( *id != ' ' )
                {
                        break;  /* id points to 1st char of id substring */
                }
        }

        /* work backwards to eliminate trailing blanks and find end of value substring */
        for (valEnd = (in + inLen); valEnd > in; valEnd--)
        {
                if ( *(valEnd - 1) != ' ' )
                {
                        break;  /* valEnd points to 1st char following value substring */
                }
        }

        if (singleValue)  /* value is single word */
        {
                /* work backwards to find start of value substring */
                for (val = valEnd; val > in; val--)
                {
                        if ( *(val - 1) == ' ' )
                        {
                                break;  /* val points to 1st char of value substring */
                        }
                }

                /* work backwards to find end of id substring */
                for (idEnd = val; idEnd > in; idEnd--)
                {
                        if ( *(idEnd - 1) != ' ' )
                        {
                                break;  /* idEnd points to 1st char following id substring */
                        }
                }
        }
        else  /* identifier is single word */
        {
                /* work forward to find end of id substring */
                for (idEnd = id; idEnd < (in + inLen); idEnd++)
                {
                        if ( *idEnd == ' ' )
                        {
                                break;  /* idEnd points to 1st char following id substring */
                        }
                }

                /* work forward to find beginning of value substring */
                for (val = idEnd; val < (in + inLen); val++)
                {
                        if ( *val != ' ' )
                        {
                                break;  /* val points to 1st char of value substring */
                        }
                }
        }

        /* calculate substring lengths and number of fill chars needed */
        idLen = idEnd - id;  /* length of id substring */
        valLen = valEnd - val;  /* length of value substring */
        fill = width - (indent + idLen + valLen);

        /* sanity check line width -- if line will exceed width then don't print anything */
        if (fill >= 0)
        {
                cncat(out, ' ', indent);                                /* indent */
                (void)strncat((char *)out, (char *)id, idLen);          /* identifier */
                if (fill >= 1)
                        cncat(out, ' ', 1);                             /* blank */
                if (fill >= 3)
                        cncat(out, fillChar, fill - 2);                 /* fill */
                if (fill >= 2)
                        cncat(out, ' ', 1);                             /* blank */
                (void)strncat((char *)out, (char *)val, valLen);        /* value */
        }

        /* replace '_' chars with ' ' */
        for (p = out; *p != '\0'; p++)
        {
                if (*p == '_')
                {
                        *p = ' ';
                }
        }
}

/************************************************************************/


static ML_PRINT_RESULT MLTemp(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetTempZonePresence(param) == ZONE_PRESENT)
        {
                if (GetTempOnOff(param) == ON)
                {
                        TransferMsg(ML_TEMP, tmpStr, GetTempSetpt((pZONE_TABLE)param));
                }
                else
                {
                        TransferMsg(ML_TEMP_OFF, tmpStr);
                }
        }
        else
        {
                TransferMsg(ML_TEMP_NOT_INSTALLED, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLTempCPF(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        switch ( GetTempZonePresence (param) )
        {
           case NO_ZONE:         return ML_NO_PRINT;

           case ZONE_PRESENT:

                if (GetTempOnOff(param) == ON)
                {
                        TransferMsg(ML_TEMP, tmpStr, GetTempSetpt((pZONE_TABLE)param));
                }
                else
                {
                        TransferMsg(ML_TEMP_OFF, tmpStr);
                };
                break ;

           default:
                TransferMsg(ML_TEMP_NOT_INSTALLED, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

#if 0
static ML_PRINT_RESULT MLAIBTemp(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

   if ( GetCPFOIMPresence ((param == pFRONT_DET_TEMP) ? FRONT : BACK))
   {
      return MLTempCPF(s,index,param) ;
   }
      return MLTemp(s,index,param) ;
}
#endif

/************************************************************************/

/*
** MLDoInitTime - used by oven because oven init time is always printed,
**                even when oven off, since it determines the run length.
*/
static ML_PRINT_RESULT MLDoTempInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetTempZonePresence(param) == ZONE_PRESENT)
        {
                TransferMsg(ML_INIT_TIME, tmpStr, GetInitTimeSetpt(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}


static BIT8 NoImmedAuxRamp( void *param)
{
        if (param == pAUX_1_TEMP)
        {
             switch (GetAuxType( (U_INT16)1  ) )
             {
             case CRYO_TRAP:
             case FPD_AUX:
                     return 1;
             default:
                     break;
             }
        }

        if (param == pAUX_2_TEMP)
        {
             switch (GetAuxType( (U_INT16)2  ) )
             {
             case CRYO_TRAP:
             case FPD_AUX:
                     return 1;
             default:
                     break;
             }
        }

        return 0 ;
}

/* MLInitTime - used by all temperature ramps except oven */
static ML_PRINT_RESULT MLTempInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if ( NoImmedAuxRamp(param) ) return ML_NO_PRINT ;

        return (GetTempOnOff(param) == ON) ? MLDoTempInitTime(s, index, param) : ML_NO_PRINT;
}

/************************************************************************/

static ML_PRINT_RESULT DoTempRamp(BIT8 *s, U_INT8 index, pZONE_TABLE p, U_INT8 max_ramp_levels)
{
        INT32 rate, temp, time;

        if (GetTempOnOff(p) == ON)
        {
                if (index > max_ramp_levels)
                {
                        return ML_NO_PRINT;             /* max ramps exceeded */
                }
                else if ((rate = GetRateSetpt(p, index)) == 0)
                {
                        if ( (index > 1) && (GetRateSetpt(p, index - 1) == 0) )
                        {
                                return ML_NO_PRINT;     /* we stop printing after the first zero ramp */
                        }
                        else
                        {
                                TransferMsg(ML_TEMP_RAMP_OFF, s, index, rate);
                                return ML_PRINT;        /* this is the last ramp line */
                        }
                }
                else
                {
                        temp = GetFinalTempSetpt(p, index);
                        time = GetFinalTimeSetpt(p, index);
                        TransferMsg(ML_TEMP_RAMP, s, index, rate, temp, time);
                        return ML_PRINT_LOOP;           /* more lines may follow */
                }
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static void AppendOnOff(BIT8 *s, ON_OFF onoff)
{
        TransferMsg(onoff == ON ? ML_ON : ML_OFF, s + strlen((char *)s));
}

static void AppendParenOff(BIT8 *s, ON_OFF onoff)
{
        if (onoff != ON)
        {
                TransferMsg(ML_PAREN_OFF, s + strlen((char *)s));
        }
}

/************************************************************************/

#if 0
static ML_PRINT_RESULT MLBlankLine(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;
        (void) s;

        return ML_PRINT;
}
#endif

static ML_PRINT_RESULT MLTitle(BIT8 *s, U_INT8 index, void *param)
{
        DATETIME when;
        BIT8     *label;

        (void) index;
        (void) param;

        INTERRUPTS_OFF
        when = DateTime;  /* this is a structure, so protect from interrupts */
        INTERRUPTS_ON

        label = &GCName[0] ;
        if ( ( *label< 2) || ( *label > 127 ) )
        {
             TransferMsg(ML_TITLE, s);
        }
        else
        {
           TransferMsg (OEM_PRODUCT_NO_MSG, s   ,label) ;
        }

        (void)strcat((char *)s, "  ");
        TransferMsg (GetDateString(when.month), s + strlen((char *)s), when.day, when.year);    /* DD Month YY */
        TransferMsg (ML_TIME, s + strlen((char *)s), when.hour, when.minute);                   /* HH:MM */
        return ML_PRINT;
}

/************************************************************************/

static ML_PRINT_RESULT MLOvenTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_OVEN_TITLE, s);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLOvenMax(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetTempOnOff(pOVEN_TEMP) == ON)
        {
                TransferMsg(ML_OVEN_MAX, tmpStr, GetOvenMax());
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLOvenEquib(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetTempOnOff(pOVEN_TEMP) == ON)
        {
                TransferMsg(ML_OVEN_EQUIB, tmpStr, GetOvenEquibTime());
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLCryoTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        switch (GetCryoType( param ))
        {
        case CO2_CRYO:
                msg = ML_CRYO_CO2_TITLE;
                break;
        case N2_CRYO:
                msg = ML_CRYO_N2_TITLE;
                break;
        case FORCED_AIR:
                msg = ML_CRYO_AIR_TITLE;
                break;
        default:
                msg = ML_CRYO_NOT_INSTALLED;
                break;
        }

        TransferMsg(msg, s);
        if (msg != ML_CRYO_NOT_INSTALLED ) AppendParenOff(s, GetCryoOnOff( param ));
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSZCryoTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        if (GetTempZonePresence( param ) == NO_ZONE)  return ML_NO_PRINT ;

        if (param == pAUX_1_TEMP)
        {
             if (GetAuxType( (U_INT16)1) != CRYO_TRAP)  return ML_NO_PRINT ;
        }
        else if (param == pAUX_2_TEMP)
        {
             if (GetAuxType( (U_INT16)2) != CRYO_TRAP)  return ML_NO_PRINT ;
        }
        else
        {
             switch (GetInletType( param == pFRONT_INLET_TEMP ? pFRONT_INLET : pBACK_INLET) )
             {
             case SIMDIST:
             case CIS4:
                     break;
             default:
                     return ML_NO_PRINT ;
             };
        };

        switch (GetCryoType( param ))
        {
        case CO2_CRYO:
                msg = ML_CRYO_CO2_TITLE;
                break;
        case N2_CRYO:
                msg = ML_CRYO_N2_TITLE;
                break;
        case FORCED_AIR:
                msg = ML_CRYO_AIR_TITLE;
                break;
        case NO_CRYO:
        default:
                msg = ML_MSG_CRYO_NONE;
                break;
        }

        TransferMsg(msg, s);
        if (msg != ML_MSG_CRYO_NONE ) AppendParenOff(s, GetCryoOnOff( param ));
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSZCryoTemp(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if ( (GetTempZonePresence( param ) == NO_ZONE) ||
             (       GetCryoOnOff( param ) == OFF    )     )  return ML_NO_PRINT;

        switch (GetCryoType( param ))
        {
        case CO2_CRYO:
        case N2_CRYO:
                TransferMsg (ML_MSG_USE_CRYO_TEMP, tmpStr, GetCryoAmbientTemp( param ));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        default:
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLSZCryoCoolMode(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if ( (GetTempZonePresence( param ) == NO_ZONE) ||
             (       GetCryoOnOff( param ) == OFF    )     )  return ML_NO_PRINT;

        switch (GetCryoType( param ))
        {
        case CO2_CRYO:
        case N2_CRYO:
                if ( GetCryoBlastOnOff( param ) == ON )
                {
                     msg = ML_AUX_CRYO_COOL_FAST;
                }
                else
                {
                     msg = ML_AUX_CRYO_COOL_WAIT;
                }
                TransferMsg(msg, tmpStr);
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        default:
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLSZCryoTimeout(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if ( (GetTempZonePresence( param ) == NO_ZONE) ||
             (       GetCryoOnOff( param ) == OFF    )     )  return ML_NO_PRINT;

        switch (GetCryoType( param ))
        {
        case CO2_CRYO:
        case N2_CRYO:
                if (GetCryoTimeoutOnOff( param ) == OFF)
                {
                   TransferMsg( ML_CRYO_TIMEOUT_OFF, tmpStr);
                }
                else
                {
                   TransferMsg(ML_CRYO_TIMEOUT, tmpStr, GetCryoTimeout( param ));
                };
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        default:
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLSZCryoFault(BIT8 *s, U_INT8 index, void *param)
{
        BIT8 only_air_cooled;
        (void) index;
        (void) param;

        if ( (GetTempZonePresence( param ) == NO_ZONE) ||
             (       GetCryoOnOff( param ) == OFF    )     )  return ML_NO_PRINT;

        only_air_cooled = FALSE;

        if ( (param != pAUX_1_TEMP) && (param != pAUX_2_TEMP) )
        {
             if  ( (GetInletType( param == pFRONT_INLET_TEMP ? pFRONT_INLET : pBACK_INLET) ) == SIMDIST )
                 only_air_cooled = TRUE;
        };

        if ( GetCryoType( param ) == NO_CRYO ) return ML_NO_PRINT;

        TransferMsg( only_air_cooled ? ML_COOLING_FAULT : ML_CRYO_FAULT ,  tmpStr);
        AppendOnOff(tmpStr, GetCryoShutdownOnOff( param ));
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;

}

static ML_PRINT_RESULT MLCryoFault(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetCryoPresence( param ) && (GetCryoOnOff( param ) == ON))
        {
                TransferMsg(ML_CRYO_FAULT, tmpStr);
                AppendOnOff(tmpStr, GetCryoShutdownOnOff( param ));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCryoTimeout(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if ( GetCryoType(param) == FORCED_AIR )   return ML_NO_PRINT;

        if (GetCryoPresence( param ) && (GetCryoOnOff( param ) == ON))
        {
                TransferMsg(ML_CRYO_TIMEOUT, tmpStr, GetCryoTimeout( param ));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCryoQuickCool(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if   (     GetCryoType(param) == FORCED_AIR )   return ML_NO_PRINT;

        if (GetCryoPresence( param ) && (GetCryoOnOff( param ) == ON))
        {
                TransferMsg(ML_CRYO_QUICK_COOL, tmpStr);
                AppendOnOff(tmpStr, GetCryoBlastOnOff( param ));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCryoAmbient(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if   (     GetCryoType(param) == FORCED_AIR )   return ML_NO_PRINT;

        if (GetCryoPresence( param ) && (GetCryoOnOff( param ) == ON))
        {
                TransferMsg(ML_CRYO_AMBIENT, tmpStr, GetCryoAmbientTemp( param ));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLRampTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetTempOnOff(param) == ON)
        {
                TransferMsg(ML_RAMP_TITLE, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLRampHead(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if ( NoImmedAuxRamp(param) ) return ML_NO_PRINT ;

        if (GetTempOnOff(param) == ON)
        {
                TransferMsg(ML_TEMP_RAMP_HEAD, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLRampHeadUL(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if ( NoImmedAuxRamp(param) ) return ML_NO_PRINT ;

        if (GetTempOnOff(param) == ON)
        {
                TransferMsg(ML_TEMP_RAMP_HEAD_UL, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLRamp(BIT8 *s, U_INT8 index, void *param)
{
        if ( NoImmedAuxRamp(param) ) return ML_NO_PRINT ;

        return DoTempRamp(s, index, param, RAMP_LEVELS);
}

static ML_PRINT_RESULT MLOvenRamp(BIT8 *s, U_INT8 index, void *param)
{
        return DoTempRamp(s, index, param, OVEN_RAMP_LEVELS);
}

/************************************************************************/

/* tabular inlet presence functions donated by Rick Wikfors */

#define ISPT_PRES_EQUIB   0
#define ISPT_FLOW_EQUIB   1
#define ISPT_GAS_TYPE     2
#define ISPT_ON_OFF       3
#define ISPT_MODE         4
#define ISPT_PRESSURE     5
#define ISPT_TOTAL_FLOW   6
#define ISPT_SPLIT_RATIO  7
#define ISPT_PURGE_FLOW   8
#define ISPT_PURGE_TIME   9
#define ISPT_PULSE_PRES  10
#define ISPT_PULSE_TIME  11
#define ISPT_MISER_ONOFF 12
#define ISPT_MISER_FLOW  13
#define ISPT_MISER_TIME  14
#define ISPT_CISx_VENT   15
#define ISPT_VI_SETPTS   16

static const BIT8 InletSetptPresenceTable[ 5 ] [ 2 ] [ 2 ] [ 6 ] [ 17 ] =
{
 { /* purged packed=1 */
  { /* manual */
   {  /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
  { /* epc */
   {  /* No  Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
 }, /* purged packed=1 */

 {  /* cool on column=2 */
  { /* manual */
   {  /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
  { /* epc Cool On Column */
   {  /* No  Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  0,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
 }, /* cool on column=2 */

 {  /* split splitless=3 */
  { /* manual  */
   {  /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
    { /* Split       */   0,   0,   0,   0,  1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
  { /* epc */
   {  /* No  Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   1,   1,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   1,   1,  1,   1,   1,   0,   0,   0,   1,   1,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   1,   0,   0,   0,   0,   1,   1,   1,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   0,   0,   1,   1,   1,   0,  0 },
    { /* P Splitless */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   1,   1,   1,   1,   1,   0,  0 },
    { /* P Split     */   0,   0,   1,   1,  1,   1,   1,   1,   0,   0,   1,   1,   1,   1,   1,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
 }, /* split splitless=3 */

 {  /*  CIS3/4=4 */
  { /* manual */
   {  /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
  { /* epc */
   {  /* No  Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   1,   1,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   1,   1,  1,   1,   1,   0,   0,   0,   1,   1,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   0,   0,   0,   0,   0,   1,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   1,   0,   0,   0,   0,   1,   1,   1,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   0,   0,   1,   1,   1,   0,  0 },
    { /* P Splitless */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   1,   1,   1,   1,   1,   0,  0 },
    { /* P Split     */   0,   0,   1,   1,  1,   1,   1,   1,   0,   0,   1,   1,   1,   1,   1,   0,  0 },
    { /* Solvnt Vent */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   0,   0,   1,   1,   1,   1,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
 }, /*  CIS3/4=4 */

 {  /*  Volatiles=5 */
  { /* manual */
   {  /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 }
   }
  },
  { /* epc */
   {  /* No  Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   1,   0,   0,   1,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   1,   1,  1,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  1 }
   },
   {  /* Has Column  */
    { /* Split       */   0,   0,   1,   1,  1,   1,   1,   1,   0,   0,   0,   0,   1,   1,   1,   0,  0 },
    { /* Splitless   */   0,   0,   1,   1,  1,   1,   0,   0,   1,   1,   0,   0,   1,   1,   1,   0,  0 },
    { /* P Splitless */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* P Split     */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Solvnt Vent */   0,   0,   0,   0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  0 },
    { /* Direct      */   0,   0,   1,   1,  1,   1,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  1 }

      /* No  Column     Pres Flow Gas  On  Mode      Totl Splt Purg Purg Puls Puls Misr Misr Misr CISx VI  */
      /*                Eqib Eqib Type Off      Pres Flow Rato Flow Time Pres Time  On  Flow Time Vent SPs */
   }
  }
 }  /*  Volatiles=5 */

};

static BIT8 CheckParamPresence ( pINLET_STATUS status, U_INT8 param_num )
/*  InletSetptPresenceTable[ 5 ] [ 2 ] [ 2 ] [ 6 ] [ 17 ] */
{
   if ( GetInletBaseType( status ) == UNKNOWN_INLET ) return 0 ;
   return InletSetptPresenceTable [ (int)GetInletBaseType( status ) ]
                                  [ EpcInlet( status ) ]
                                  [ InletHasColumn( status ) ]
                                  [ (int)GetInletInjectMode ( status ) ]
                                  [ param_num ];
}

#if 0
static BIT8 PresEquibPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PRES_EQUIB );
}
#endif

#if 0
static BIT8 FlowEquibPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_FLOW_EQUIB );
}
#endif

#if 0
static BIT8 GasTypePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_GAS_TYPE );
}
#endif
#if 0
static BIT8 OnOffPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_ON_OFF );
}
#endif

#if 0
static BIT8 ModePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_MODE );
}
#endif

static BIT8 PressurePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PRESSURE );
}

static BIT8 TotalFlowPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_TOTAL_FLOW );
}

static BIT8 SplitRatioPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_SPLIT_RATIO );
}

static BIT8 PurgeFlowPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PURGE_FLOW );
}

static BIT8 PurgeTimePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PURGE_TIME );
}

static BIT8 VISetptsPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_VI_SETPTS );
}

static BIT8 CISxVentPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_CISx_VENT );
}

static BIT8 PulsePresPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PULSE_PRES );
}

static BIT8 PulseTimePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_PULSE_TIME );
}

#if 0
static BIT8 MiserOnOffPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_MISER_ONOFF );
}
#endif

#if 0
static BIT8 MiserFlowPresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_MISER_FLOW );
}
#endif

#if 0
static BIT8 MiserTimePresent ( pINLET_STATUS status )
{
    return CheckParamPresence ( status, ISPT_MISER_TIME );
}
#endif

/* functions below this point by JSD */

static BIT8 MiserModePresent( pINLET_STATUS status )
{
        return ( CheckParamPresence(status, ISPT_MISER_ONOFF) && InletHasColumn(status) );
}

static BIT8 MiserOn ( pINLET_STATUS status )
{
        return ( MiserModePresent(status) && (GetInletMiserMode(status) == ON) );
}

static CONTROL_MODE GetMLColControlMode( void *parm   )
{
        if ( EpcSource(parm) ) return GetColumnControlMode(parm) ;
        return UNKN ;
}

/************************************************************************/

static ML_PRINT_RESULT MLFrntInletTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

      if ( FIName[0] != 0 )
      {
          msg = MSG_CPF_FINLET_TITLE;
      }
      else
      {
        switch(GetInletType(pFRONT_INLET))
        {
        case PP:
        case MANUAL_PP:
                msg = ML_FRNT_INLET_PP_TITLE;
                break;
        case COC:
        case MANUAL_COC:
                msg = ML_FRNT_INLET_COC_TITLE;
                break;
        case SS:
        case MANUAL_SS:
                msg = ML_FRNT_INLET_SS_TITLE;
                break;
        case SIMDIST:
                msg = ML_FRNT_INLET_PCM_TITLE;
                break;
        case CIS3:
                msg = ML_FRNT_INLET_CIS3_TITLE;
                break;
        case CIS4:
                msg = ML_FRNT_INLET_CIS4_TITLE;
                break;
        case VOLATILES:
                msg = ML_FRNT_INLET_VI_TITLE;
                break;

        default:
                msg = ML_FRNT_INLET_NOT_INSTALLED;
                break;
        }
      }
        /*
        TransferMsg(msg, s);
        return ML_PRINT;
        */
      TransferMsg (msg, s,  FIName  );
      return ML_PRINT;
}
static ML_PRINT_RESULT MLBackInletTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

      if ( BIName[0] != 0 )
      {
          msg = MSG_CPF_BINLET_TITLE;
      }
      else
      {
        switch(GetInletType(pBACK_INLET))
        {
        case PP:
        case MANUAL_PP:
                msg = ML_BACK_INLET_PP_TITLE;
                break;
        case COC:
        case MANUAL_COC:
                msg = ML_BACK_INLET_COC_TITLE;
                break;
        case SS:
        case MANUAL_SS:
                msg = ML_BACK_INLET_SS_TITLE;
                break;
        case SIMDIST:
                msg = ML_BACK_INLET_PCM_TITLE;
                break;
        case CIS3:
                msg = ML_BACK_INLET_CIS3_TITLE;
                break;
        case CIS4:
                msg = ML_BACK_INLET_CIS4_TITLE;
                break;
        case VOLATILES:
                msg = ML_BACK_INLET_VI_TITLE;
                break;
        default:
                msg = ML_BACK_INLET_NOT_INSTALLED;
                break;
        }
      }
        /*
        TransferMsg(msg, s);
        return ML_PRINT;
        */
      TransferMsg (msg, s,  BIName  );
      return ML_PRINT;

}

/************************************************************************/

static ML_PRINT_RESULT MLInletTempMode(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (GetOvenTrackModeOnOff(param) == ON)
        {
                msg = ML_MODE_TRACK_OVEN;
        }
        else
        {
                msg = ML_MODE_RAMPED_TEMP;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLInletMode(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        switch (GetInletInjectMode(param))
        {
        case SOLVENT_VENT:
                msg = ML_MODE_SOLVENT_VENT;
                break;

        case SPLIT:
                msg = ML_MODE_SPLIT;
                break;

        case SPLITLESS:
                msg = ML_MODE_SPLITLESS;
                break;

        case SPLIT_PULSED:
                msg = ML_MODE_SPLIT_PULSED;
                break;

        case DIRECT:
                msg = ML_MODE_DIRECT;
                break;

        case SPLITLESS_PULSED:
        default:
                msg = ML_MODE_SPLITLESS_PULSED;
                break;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLCOCInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetOvenTrackModeOnOff(param) == OFF)
        {
                return MLTempInitTime(s, index, param);
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCOCRampTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (GetOvenTrackModeOnOff(param) == OFF)
        {
                if (param == pFRONT_INLET_TEMP)
                {
                        msg = ML_FRONT_INLET_RAMP_TITLE;
                }
                else
                {
                        msg = ML_BACK_INLET_RAMP_TITLE;
                }

                TransferMsg(msg, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCOCRampHead(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetOvenTrackModeOnOff(param) == OFF)
        {
                return MLRampHead(s, index, param);
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCOCRampHeadUL(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetOvenTrackModeOnOff(param) == OFF)
        {
                return MLRampHeadUL(s, index, param);
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCOCRamp(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetOvenTrackModeOnOff(param) == OFF)
        {
                return MLRamp(s, index, param);
        }
        else
        {
                return ML_NO_PRINT;
        }
}


static void MLDoPressure(BIT8 *s, INT32 pressure)
{
        U_INT16 msg;

        switch (GetPresUnits())
        {
        case DISPLAY_BAR:
                msg = ML_PRESSURE_BAR;
                break;

        case DISPLAY_PSI:
                msg = ML_PRESSURE_PSI;
                break;

        case DISPLAY_KPA:
        default:  /* assert: default should never occur */
                msg = ML_PRESSURE_KPA;
                break;
        }

        TransferMsg(msg, s, pressure);
}

static ML_PRINT_RESULT MLInletPres(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PressurePresent(param))
        {
                if (GetInletState(param) == ON)
                {
                        MLDoPressure(tmpStr, GetInletPresSetpt(param));
                }
                else
                {
                        TransferMsg(ML_PRESSURE_OFF, tmpStr);
                }
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCISxVentPres  (BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (CISxVentPresent(param))
        {
                switch (GetPresUnits())
                {
                case DISPLAY_BAR:
                        msg = ML_VENT_PRESSURE_BAR;
                        break;

                case DISPLAY_PSI:
                        msg = ML_VENT_PRESSURE_PSI;
                        break;

                case DISPLAY_KPA:
                default:  /* assert: default should never occur */
                        msg = ML_VENT_PRESSURE_KPA;
                        break;
                }

                TransferMsg(msg, tmpStr, GetVentPressure(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCISxVentFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (CISxVentPresent(param))
        {
                TransferMsg(ML_VENT_FLOW, tmpStr, GetInletVentFlow(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLVISmplgEnd(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (VISetptsPresent(param))
        {
                TransferMsg(ML_SMPLG_END, tmpStr, GetVIInjTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLCISxVentTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (CISxVentPresent(param))
        {
                TransferMsg(ML_VENT_TIME, tmpStr, GetVentTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletPulsePres(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (PulsePresPresent(param))
        {
                switch (GetPresUnits())
                {
                case DISPLAY_BAR:
                        msg = ML_PULSE_PRESSURE_BAR;
                        break;

                case DISPLAY_PSI:
                        msg = ML_PULSE_PRESSURE_PSI;
                        break;

                case DISPLAY_KPA:
                default:  /* assert: default should never occur */
                        msg = ML_PULSE_PRESSURE_KPA;
                        break;
                }

                TransferMsg(msg, tmpStr, GetPressurePulsePressure(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletPulseTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PulseTimePresent(param))
        {
                TransferMsg(ML_PULSE_TIME, tmpStr, GetPressurePulseTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletSplitRatio(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (SplitRatioPresent(param))
        {
                TransferMsg(ML_SPLIT_RATIO, tmpStr, GetInletSplitRatio(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletSplitFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (SplitRatioPresent(param))
        {
                TransferMsg(ML_SPLIT_FLOW, tmpStr, GetInletSplitFlow(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletPurgeTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PurgeTimePresent(param))
        {
                TransferMsg(ML_PURGE_TIME, tmpStr, GetInletPurgeTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletPurgeFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PurgeFlowPresent(param))
        {
                TransferMsg(ML_PURGE_FLOW, tmpStr, GetInletPurgeFlow(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletSaverOnOff(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (MiserModePresent(param))
        {
                TransferMsg((GetInletMiserMode(param) == ON) ? ML_GAS_SAVER_ON : ML_GAS_SAVER_OFF, tmpStr);
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletSaverFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (MiserOn(param))
        {
                TransferMsg(ML_SAVER_FLOW, tmpStr, GetInletMiserFlow(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLInletSaverTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (MiserOn(param))
        {
                TransferMsg(ML_SAVER_TIME, tmpStr, GetInletMiserTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}


static ML_PRINT_RESULT MLInletTotalFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (TotalFlowPresent(param))
        {
                TransferMsg((GetInletState(param) == ON) ? ML_TOTAL_FLOW : ML_TOTAL_FLOW_OFF, tmpStr, GetInletFlowSetpt(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLSplitVentCfg(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        /* PNEU_PORT_STATE GetVISplitPort ( pINLET_STATUS status ) */

        if ( GetVISplitPort(param) == CAPPED )
        {
          msg = ML_VENT_STATE_CAPPED;
        }
        else
        {
          msg = ML_VENT_STATE_PLUMBED;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLInletGas(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        switch(GetInletGasType(param))
        {
        case He:
                msg = ML_GAS_TYPE_HE;
                break;

        case H2:
                msg = ML_GAS_TYPE_H2;
                break;

        case N2:
                msg = ML_GAS_TYPE_N2;
                break;

        default:  /* 95% Argon + 5% Methane */
                msg = ML_GAS_TYPE_ARCH4;
                break;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

/************************************************************************/

/* tabular column presence functions donated by Rick Wikfors */

#define PS   1     /* pressure setpt  */
#define PA   2     /* pressure actual */
#define FS   4     /* flow setpt      */
#define FA   8     /* flow actual     */
#define VS  16     /* velocity setpt  */

#define   NO_LINE_DISPLAYED        0
#define   DISPLAY_SETPT_ONLY       1
#define   DISPLAY_ACTUAL_ONLY      2
#define   DISPLAY_SETPT_AND_ACTUAL 3

#define PRESENCE_BITS  BIT8

static const PRESENCE_BITS ColPresenceBits [ 2 /* column defined */ ]
                                           [ 15 /* source type   */ ]
                                           [ 4 /* control mode   */ ] = {
{ /* un defined */            /*         Const P          Const F           Ramp P          Ramp F        */
             /* PP_INLET      */  {             0,        PA|FS|FA,                0,     PA|FS|FA    },
             /* COC_INLET     */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* SS_INLET      */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* PTV_INLET     */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* MAN_PP_INLET  */  {             0,               0,                0,            0    },
             /* MAN_COC_INLET */  {             0,               0,                0,            0    },
             /* MAN_SS_INLET  */  {             0,               0,                0,            0    },
             /* SOME_AUX      */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* UNKNOWN_TYPE  */  {             0,               0,                0,            0    },

             /* ACI_INLET     */  {             0,               0,                0,            0    }, /* null for now */
             /* MAN_ACI_INLET */  {             0,               0,                0,            0    }, /* null for now */
             /* G_PTV_INLET   */  {             0,               0,                0,            0    }, /* null for now */
             /* CIS4_INLET    */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* SIMDIST_INLET */  {             0,        PA|FS|FA,                0,     PA|FS|FA    },
             /* CIS3_INLET    */  {         PS|PA,           PS|PA,            PS|PA,            0    }
             /* VOLATILES_capped                       same as PP_INLET w/ undefined column           */
             /* VOLATILES_plumbed                      same as SS_INLET w/ undefined column           */},

{ /* defined */
             /* PP_INLET      */  {    PS|PA|FS|VS,    PS|PA|FS|VS,       PS|PA|FS|VS,  PS|PA|FS|VS   },
             /* COC_INLET     */  {    PS|PA|FS|VS,    PS|PA|FS|VS,       PS|PA|FS|VS,  PS|PS|FS|VS   },
             /* SS_INLET      */  {    PS|PA|FS|VS,    PS|PA|FS|VS,       PS|PA|FS|VS,  PS|PA|FS|VS   },
             /* PTV_INLET     */  {              0,              0,                 0,            0   },
#if 0
/* for keyboard purposes, use calculator mode */
             /* MAN_PP_INLET  */  {              0,       PS|FS|VS,                 0,            0   },
             /* MAN_COC_INLET */  {       PS|FS|VS,              0,                 0,            0   },
             /* MAN_SS_INLET  */  {       PS|FS|VS,              0,                 0,            0   },
#else
/* for method list purposes, manual inlets have no setpoints */
             /* MAN_PP_INLET  */  {              0,              0,                 0,            0   },
             /* MAN_COC_INLET */  {              0,              0,                 0,            0   },
             /* MAN_SS_INLET  */  {              0,              0,                 0,            0   },
#endif
             /* SOME_AUX      */  {    PS|PA|FS|VS,    PS|PA|FS|VS,       PS|PA|FS|VS,  PS|PA|FS|VS   },
             /* UNKNOWN_TYPE  */  {              0,              0,                 0,            0   },

             /* ACI_INLET     */  {             0,               0,                0,            0    }, /* null for now */
             /* MAN_ACI_INLET */  {             0,               0,                0,            0    }, /* null for now */
             /* G_PTV_INLET   */  {             0,               0,                0,            0    }, /* null for now */
             /* CIS4_INLET    */  {         PS|PA,           PS|PA,            PS|PA,            0    },
             /* SIMDIST_INLET */  {    PS|PA|FS|VS,    PS|PA|FS|VS,       PS|PA|FS|VS,  PS|PA|FS|VS   },
             /* CIS3_INLET    */  {         PS|PA,           PS|PA,            PS|PA,            0    }
             /* VOLATILES_capped                       same as PP_INLET w/   defined column           */
             /* VOLATILES_plumbed                      same as SS_INLET w/   defined column           */} };

static BIT8 ColPresSetptPresent( pCOLUMN_STATUS status )
{
     PRESENCE_BITS mask;

     mask = ColPresenceBits[(int)status->Config->Defined] [(int)GetColSrcType(status)] [(int)status->Wkfile->Control_Mode];

     return ( mask / PS ) & DISPLAY_SETPT_ONLY;
}

static BIT8 ColFlowSetptPresent( pCOLUMN_STATUS status )
{
     PRESENCE_BITS mask;

     mask = ColPresenceBits[(int)status->Config->Defined] [(int)GetColSrcType(status)] [(int)status->Wkfile->Control_Mode];

     return ( mask / FS ) & DISPLAY_SETPT_ONLY;
}

static BIT8 ColVeloSetptPresent( pCOLUMN_STATUS status )
{
     PRESENCE_BITS mask;

     mask = ColPresenceBits[(int)status->Config->Defined] [(int)GetColSrcType(status)] [(int)status->Wkfile->Control_Mode];

     return ( mask / VS ) & DISPLAY_SETPT_ONLY;
}

/* end of Rick's donation */

/************************************************************************/

static ML_PRINT_RESULT MLCol1Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (ColumnDefined(pCOLUMN_1))
        {
                TransferMsg(ML_COLUMN_TITLE, s, (INT32)1);
        }
        else
        {
                TransferMsg(ML_COLUMN_NOT_DEFINED, s, (INT32)1);
        }

        return ML_PRINT;
}

static ML_PRINT_RESULT MLCol2Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (ColumnDefined(pCOLUMN_2))
        {
                TransferMsg(ML_COLUMN_TITLE, s, (INT32)2);
        }
        else
        {
                TransferMsg(ML_COLUMN_NOT_DEFINED, s, (INT32)2);
        }

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColLength(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        if (ColumnDimsKnown(param))
        {
                TransferMsg(ML_LENGTH, tmpStr, GetColumnLength(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        }
        else
        {
                TransferMsg(ML_DIM_UNKNOWN, tmpStr);
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        }
        return ML_PRINT;
}

static ML_PRINT_RESULT MLColDiameter(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        if (ColumnDimsKnown(param))
        {
                TransferMsg(ML_DIAMETER, tmpStr, GetColumnDiam(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                /* dimension unknown message printed by MLColLength */
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFilmThickness(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        if (ColumnDimsKnown(param))
        {
                TransferMsg(ML_FILM_THICKNESS, tmpStr, GetColumnFilmThickness(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                /* dimension unknown message printed by MLColLength */
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColInlet(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;
        INT32 aux;

        (void) index;
        (void) param;

        aux = 3;
        msg = ML_INLET_AUX;

        switch (GetColumnSource(param))
        {
        case FRNT_INLET:
                msg = ML_INLET_FRONT;
                break;

        case BACK_INLET:
                msg = ML_INLET_BACK;
                break;

        case AUX_3:
                break;

        case AUX_4:
                aux = 4;
                break;

        case AUX_5:
                aux = 5;
                break;

        case UNKNOWN_SOURCE:
        default:
                msg = ML_INLET_UNSPECIFIED;
                break;
        }

        TransferMsg(msg, tmpStr, aux);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColDetector(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        switch (GetColumnOutlet(param))
        {
        case FRNT_DET:
                msg = ML_DET_FRONT;
                break;

        case BACK_DET:
                msg = ML_DET_BACK;
                break;

        case MSD:
                msg = ML_DET_MSD;
                break;

        case AED:
                msg = ML_DET_AED;
                break;

        case UNKNOWN_OUTLET:
        default:
                msg = ML_DET_OTHER;
                break;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColVacuumCorrect(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        switch (GetColumnVacuumComp(param))
        {
        case ON:
                msg = ML_VACUUM_ON;
                break;

        case OFF:
        default:
                msg = ML_VACUUM_OFF;
                break;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColPresCorrect(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (ColumnOutletPresCompEnabled(param))
        {
                TransferMsg(ML_PRES_CORRECT, tmpStr, GetColumnOutletPresCompSetpt(param));
        }
        else
        {
                TransferMsg(ML_PRES_CORRECT_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColPressure(BIT8 *s, U_INT8 index, void *param)
{
        pAUX_STATUS aux;
        pINLET_STATUS inlet;

        (void) index;
        if (ColPresSetptPresent(param))
        {
                switch(GetColSourceType(param))
                {
                case SIMDIST_INLET:
                case PP_INLET:
                        if (!SourcePressureControlled(param))
                        {
                                MLDoPressure(tmpStr, GetColumnInitPres(param));
                                break;  /* escape switch statement */
                        }
                        /* intentional fall through if source is pressure controlled */

                case COC_INLET:
                case SS_INLET:
                case PTV_INLET:
                        inlet = (GetColumnSource(param) == FRNT_INLET) ? pFRONT_INLET : pBACK_INLET;

                        if (GetInletState(inlet) == OFF)
                        {
                                TransferMsg(ML_PRESSURE_OFF, tmpStr);
                        }
                        else
                        {
                                /* REVISIT - need init pres function from Rick */
                                MLDoPressure(tmpStr, GetInletPresSetpt(inlet));
                        }
                        break;

                case SOME_AUX:
                        switch (GetColumnSource(param))
                        {
                        case AUX_3:
                                aux = pAUX_3;
                                break;

                        case AUX_4:
                                aux = pAUX_4;
                                break;

                        case AUX_5:
                        default:
                                aux = pAUX_5;
                                break;
                        }

                        if (GetAuxState(aux) == OFF)
                        {
                                TransferMsg(ML_PRESSURE_OFF, tmpStr);
                        }
                        else
                        {
                                MLDoPressure(tmpStr, GetAuxInitPres(aux));
                        }
                        break;

                default:
                        MLDoPressure(tmpStr, GetColumnInitPres(param));
                        break;
                }

                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFlow(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (ColFlowSetptPresent(param))
        {
                switch (GetColSourceType(param))
                {
                case SIMDIST_INLET:
                case PP_INLET:
                        /* don't show actual flow if purged packed with 2 columns */
                        if ( !SourcePressureControlled(param) &&
                             (GetColumnSource(pCOLUMN_1) != GetColumnSource(pCOLUMN_2)) )
                        {
                                switch (GetColumnSourceState(param))
                                {
                                case OFF:
                                        TransferMsg(ML_FLOW_OFF, tmpStr);
                                        break;

                                case ON:
                                default:  /* e.g. shutdown */
                                        TransferMsg(ML_FLOW, tmpStr, GetColumnInitFlow(param));
                                        break;
                                }
                        }

                        /* intentional fall-through */

                case COC_INLET:
                case SS_INLET:
                case PTV_INLET:
                case SOME_AUX:
                default:
                        TransferMsg(ML_FLOW, tmpStr, GetColumnInitFlow(param));
                        break;
                }

                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColAvgVelocity(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        if (ColVeloSetptPresent(param))
        {
                switch (GetColSourceType(param))
                {
                case SIMDIST_INLET:
                case PP_INLET:
                        msg = ML_AVG_VELOCITY;
                        break;

                case COC_INLET:
                case SS_INLET:
                case PTV_INLET:
                case SOME_AUX:
                default:
                        msg = ML_VELOCITY;
                        break;
                }

                TransferMsg(msg, tmpStr, GetColumnInitVel(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColMode(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;
        (void) param;

        switch ( GetColSourceType(param) )
        {
        case PP_INLET        :
        case COC_INLET       :
        case SS_INLET        :
        case PTV_INLET       :
        case SOME_AUX        :
        case SIMDIST_INLET   :
        case CIS3_INLET      :
        case CIS4_INLET      :
        case VOLATILES_INLET :
                switch (GetColumnControlMode(param))
                {
                case CONST_PRES:
                        msg = ML_MODE_PRES;
                        break;

                case CONST_FLOW:
                        msg = ML_MODE_FLOW;
                        break;

                case RAMP_PRES:
                        msg = ML_MODE_RAMP_PRES;
                        break;

                case RAMP_FLOW:
                default:
                        msg = ML_MODE_RAMP_FLOW;
                        break;
                }

                TransferMsg(msg, tmpStr);
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);

                return ML_PRINT;
        default:
                return ML_NO_PRINT;
        }


}

/************************************************************************/

static ML_PRINT_RESULT MLColFlowInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

/*      if (GetColumnControlMode(param) == RAMP_FLOW)   */
        if (GetMLColControlMode(param) == RAMP_FLOW)
        {
                TransferMsg(ML_INIT_TIME, tmpStr, GetColFlowInitTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFlowRampTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetMLColControlMode(param) == RAMP_FLOW)
        {
                TransferMsg(ML_COL_FLOW_RAMP_TITLE, s, (param == &Inst_Status.Pneu.Column_1) ? (INT32)1 : (INT32)2);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFlowRampHead(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetMLColControlMode(param) == RAMP_FLOW)
        {
                TransferMsg(ML_FLOW_RAMP_HEAD, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFlowRampHeadUL(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetMLColControlMode(param) == RAMP_FLOW)
        {
                TransferMsg(ML_FLOW_RAMP_HEAD_UL, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColFlowRamp(BIT8 *s, U_INT8 index, void *param)
{
        INT32 rate, flow, time;

        if (GetMLColControlMode(param) == RAMP_FLOW)
        {
                if (index > RAMP_LEVELS)
                {
                        return ML_NO_PRINT;             /* max ramps exceeded */
                }
                else if ((rate = GetColFlowRate(param, index)) == 0)
                {
                        if ( (index > 1) && (GetColFlowRate(param, index - 1) == 0) )
                        {
                                return ML_NO_PRINT;     /* we stop printing after the first zero ramp */
                        }
                        else
                        {
                                TransferMsg(ML_FLOW_RAMP_OFF, s, index, rate);
                                return ML_PRINT;        /* this is the last ramp line */
                        }
                }
                else
                {
                        flow = GetColFlowFinalVal(param, index);
                        time = GetColFlowFinalTime(param, index);
                        TransferMsg(ML_FLOW_RAMP, s, index, rate, flow, time);
                        return ML_PRINT_LOOP;           /* more lines may follow */
                }
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLColPresInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetMLColControlMode(param) == RAMP_PRES)
        {
                TransferMsg(ML_INIT_TIME, tmpStr, GetColPresInitTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColPresRampTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetMLColControlMode(param) == RAMP_PRES)
        {
                TransferMsg(ML_COL_PRES_RAMP_TITLE, s, (param == &Inst_Status.Pneu.Column_1) ? (INT32)1 : (INT32)2);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColPresRampHead(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetMLColControlMode(param) == RAMP_PRES)
        {
                TransferMsg(ML_PRES_RAMP_HEAD, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColPresRampHeadUL(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetMLColControlMode(param) == RAMP_PRES)
        {
                TransferMsg(ML_PRES_RAMP_HEAD_UL, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLColPresRamp(BIT8 *s, U_INT8 index, void *param)
{
        INT32 rate, pres, time;

        if (GetMLColControlMode(param) == RAMP_PRES)
        {
                if (index > RAMP_LEVELS)
                {
                        return ML_NO_PRINT;             /* max ramps exceeded */
                }
                else if ((rate = GetColPresRate(param, index)) == 0)
                {
                        if ( (index > 1) && (GetColPresRate(param, index - 1) == 0) )
                        {
                                return ML_NO_PRINT;     /* we stop printing after the first zero ramp */
                        }
                        else
                        {
                                TransferMsg(ML_PRES_RAMP_OFF, s, index, rate);
                                return ML_PRINT;        /* this is the last ramp line */
                        }
                }
                else
                {
                        pres = GetColPresFinalVal(param, index);
                        time = GetColPresFinalTime(param, index);
                        TransferMsg(ML_PRES_RAMP, s, index, rate, pres, time);
                        return ML_PRINT_LOOP;           /* more lines may follow */
                }
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLFrntDetTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;
        BIT8      *title;

        (void) index;
        (void) param;

        if ((BIT8)(FDName[0] != 0))
        {
           /* Use the type label stored in the pneu eeprom */
           TransferMsg( MSG_CPF_FDET_TITLE , s, FDName   );
           return ML_PRINT;
        }

        switch(GetDetectorType(FRONT))
        {
        case OEM_AIB:
           title = 2+MessageToString(MSG_DET_OEM_AIB);
           TransferMsg( MSG_CPF_FDET_TITLE , s, title );
           return ML_PRINT;

        case OEM_FID:
           title = 2+MessageToString(MSG_DET_OEM_FID);
           TransferMsg( MSG_CPF_FDET_TITLE , s, title );
           return ML_PRINT;

        case AIB:
                msg = ML_FRNT_DET_AIB_TITLE;
                break;

        case ECD:
                msg = ML_FRNT_DET_ECD_TITLE;
                break;

        case FID:
                msg =(GetElectrometerType(FRONT)) ? ML_FRNT_DET_ELECTROMETER_TITLE : ML_FRNT_DET_FID_TITLE;
                break;

        case FPD:
                msg = ML_FRNT_DET_FPD_TITLE;
                break;

        case NPD:
                msg = ML_FRNT_DET_NPD_TITLE;
                break;

        case TCD:
                msg = ML_FRNT_DET_TCD_TITLE;
                break;

        case uECD:
                msg = ML_FRNT_DET_uECD_TITLE;
                break;

        default:
                msg = ML_FRNT_DET_NOT_INSTALLED;
        }

        TransferMsg( msg , s   );
        return ML_PRINT;

}

static ML_PRINT_RESULT MLDetH2Gas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, FID_FUEL_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_H2_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_H2, tmpStr, GetDetectorGasFlowSetpt(param, FID_FUEL_GAS));
                }
        }
        else
        {
                TransferMsg(ML_H2_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetAirGas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, FID_AIR_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_AIR_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_AIR, tmpStr, GetDetectorGasFlowSetpt(param, FID_AIR_GAS));
                }
        }
        else
        {
                TransferMsg(ML_AIR_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

#if 0
static ML_PRINT_RESULT MLDetOxidizerGas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, FPD_AIR_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_OXIDIZER_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_OXIDIZER, tmpStr, GetDetectorGasFlowSetpt(param, FPD_AIR_GAS));
                }
        }
        else
        {
                TransferMsg(ML_OXIDIZER_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}
#endif

static ML_PRINT_RESULT MLDetRefGas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, TCD_REF_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_REF_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_REF, tmpStr, GetDetectorGasFlowSetpt(param, TCD_REF_GAS));
                }
        }
        else
        {
                TransferMsg(ML_REF_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetAnodeGas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, ECD_ANODE_PURGE_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_ANODE_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_ANODE, tmpStr, GetDetectorGasFlowSetpt(param, ECD_ANODE_PURGE_GAS));
                }
        }
        else
        {
                TransferMsg(ML_ANODE_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetMakeupGas(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetDetGasWkfileState(param, FID_MUG_GAS) == ON)
        {
                if (EpcDetector(param) == FALSE)
                {
                        TransferMsg(ML_MUG_ON, tmpStr);
                }
                else
                {
                        /* REVISIT - need wkfile value */
                        TransferMsg(ML_MUG, tmpStr, GetDetectorGasFlowSetpt(param, FID_MUG_GAS));
                }
        }
        else
        {
                TransferMsg(ML_MUG_OFF, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLCPFDetGas(BIT8 *s, BIT8 gas , void *parm )
{
        BIT8      *label;
        U_INT32  msg;
        POSITION  position;

        position = ( parm == &Inst_Status.Pneu.Frnt_Detector? FRONT : BACK );

/*      if (!GetCPFDetGasPresence(position , gas ) ) return ML_NO_PRINT;    */

        label = GetCPFGasLabel(position,  gas);
        if (*label == 0 ) return ML_NO_PRINT;

        if (GetDetGasWkfileState(parm, gas) == ON)
        {
           if ( PRES  == GetOEMGasStatus(  PresenceWhatDet(), gas ) )
           {
              switch (GetPresUnits())
              {
              case DISPLAY_BAR:
                 msg = ML_CPF_GAS_BAR_MSG;
                 break;

              case DISPLAY_KPA:
                 msg = ML_CPF_GAS_KPA_MSG;
                 break;

              case DISPLAY_PSI:
              default:
                 msg = ML_CPF_GAS_PSI_MSG;
                 break;
              };

              TransferMsg(msg,tmpStr,label, GetDetectorGasPresSetpt(parm,gas));
           }
           else
           {
           /* REVISIT - need wkfile value */
              /* TransferMsg(ML_H2, tmpStr, GetDetectorGasFlowSetpt(param, FID_FUEL_GAS));   */
              TransferMsg(ML_CPF_GAS_NORMAL_MSG,tmpStr,label,GetDetectorGasFlowSetpt(parm,gas));
           };
        }
        else
        {
                /* TransferMsg(ML_H2_OFF, tmpStr);                */
                TransferMsg(ML_CPF_GAS_OFF_MSG, tmpStr, label );
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE );
        return ML_PRINT;
}

static ML_PRINT_RESULT MLCPFDetGas1(BIT8 *s, U_INT8 index, void *param)
{
        (void)    index;

        return MLCPFDetGas( s,1,param );

}

static ML_PRINT_RESULT MLCPFDetGas2(BIT8 *s, U_INT8 index, void *param)
{
        (void)    index;

        return MLCPFDetGas( s,2,param );

}

static ML_PRINT_RESULT MLOEMDetGas3(BIT8 *s, U_INT8 index, void *param)
{
        (void)    index;

        return MLCPFDetGas( s,3,param );

}

static ML_PRINT_RESULT MLDetMode(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (GetDetConstMkupMode(param) == ON)
        {
                msg = ML_MODE_COL_MKUP_CONST;
        }
        else
        {
                msg = ML_MODE_CONST_MKUP_FLOW;
        }
        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}


static ML_PRINT_RESULT MLOEMGasTypeX(BIT8 *s,  BIT8 chanl, void *param)
{
   U_INT16 msg;
   BIT8      *label;
   POSITION  position;
   GAS_TYPE gas;

   position = ( param == &Inst_Status.Pneu.Frnt_Detector? FRONT : BACK );

   label = GetCPFGasLabel(position, chanl);
   if (*label == 0 ) return ML_NO_PRINT;

   gas = GetDetectorGasType(param, chanl );

   switch(gas)
   {
      default:
      case ArMe:
              msg = ML_OEM_GAS_TYPE_ARCH4;
              break;

      case N2:
              msg = ML_OEM_GAS_TYPE_N2;
              break;

      case He:
              msg = ML_OEM_GAS_TYPE_HE;
              break;

      case H2:
              msg = ML_OEM_GAS_TYPE_H2;
              break;

      case O2:
              msg = ML_OEM_GAS_TYPE_O2;
              break;
   };


   TransferMsg(msg, tmpStr, label );

   ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE );
   return ML_PRINT;

}

static ML_PRINT_RESULT MLOEMDetGas1Type(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMGasTypeX(s,  1, param);
}

static ML_PRINT_RESULT MLOEMDetGas2Type(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMGasTypeX(s,  2, param);
}

static ML_PRINT_RESULT MLOEMDetGas3Type(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMGasTypeX(s,  3, param);
}


static ML_PRINT_RESULT MLDetMakeupGasType(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;
        GAS_TYPE gas;

        (void) index;

        gas = GetDetectorGasType(param, FID_MUG_GAS);  /* makeup gas for all detectors is gas #3 */

        switch (GetDetectorType((param == &Inst_Status.Pneu.Frnt_Detector) ? FRONT : BACK))
        {
        case uECD:
                switch(gas)
                {
                case ArMe:
                        msg = ML_MKUP_ARCH4;
                        break;

                default:
                        msg = ML_MKUP_N2;
                        break;
                }
                break;

        case ECD:
                switch(gas)
                {
                case He:
                        msg = ML_MKUP_PRG_HE;
                        break;

                case ArMe:
                        msg = ML_MKUP_PRG_ARCH4;
                        break;

                default:
                        msg = ML_MKUP_PRG_N2;
                        break;
                }
                break;

        case TCD:
                switch(gas)
                {
                case He:
                        msg = ML_MKUP_REF_HE;
                        break;

                case H2:
                        msg = ML_MKUP_REF_H2;
                        break;

                default:
                        msg = ML_MKUP_REF_N2;
                        break;
                }
                break;

        default:
                switch(gas)
                {
                case He:
                        msg = ML_MKUP_HE;
                        break;

                default:
                        msg = ML_MKUP_REF_N2;
                        break;
                }
                break;
        }

        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

#if 0
static ML_PRINT_RESULT MLDetOxidizerGasType(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;

        (void) index;

        if (GetDetectorGasType(param, FPD_AIR_GAS) == O2)
        {
                msg = ML_OXIDIZER_O2;
        }
        else
        {
                msg = ML_OXIDIZER_AIR;
        }
        TransferMsg(msg, tmpStr);
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}
#endif

static ML_PRINT_RESULT MLDetFlame(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( (GetFlame((POSITION)(int)param) == OFF) ? ML_DET_FLAME_OFF : ML_DET_FLAME_ON, tmpStr );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetFIDLitOffset(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( ML_DET_LIT_OFFSET, tmpStr, GetFIDLitOffset((POSITION)(int)param) );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetFPDLitOffset(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( ML_DET_LIT_OFFSET, tmpStr, GetFPDLitOffset((POSITION)(int)param) );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetBeadOnOff(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( (GetNPDBeadTurnOn((POSITION)(int)param) == OFF) ? ML_DET_BEAD_OFF : ML_DET_BEAD_ON, tmpStr );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetECDTargetOffset(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( ML_DET_TARGET_OFFSET, tmpStr, GetECDTargetOffset((POSITION)(int)param) );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetNPDTargetOffset(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( ML_DET_TARGET_OFFSET, tmpStr, 10*GetNPDTargetOffset((POSITION)(int)param) );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetEquibTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( ML_DET_EQUIB_TIME, tmpStr, GetDetEquibTime((POSITION)(int)param) );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetFilamentOnOff(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( (GetTCDFilament((POSITION)(int)param) == OFF) ? ML_DET_FILAMENT_OFF : ML_DET_FILAMENT_ON, tmpStr );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetNegPolarityOnOff(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg( (GetTCDNegPolarity((POSITION)(int)param) == OFF) ? ML_DET_NEG_POLARITY_OFF : ML_DET_NEG_POLARITY_ON, tmpStr );
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLDetElectrometer(BIT8 *s, U_INT8 index, void *param)
{
   (void) index;

   TransferMsg( (GetDetOnOff((POSITION)(int)param) == OFF) ? ML_DET_ELECTROMETER_OFF : ML_DET_ELECTROMETER_ON, tmpStr );
   ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
   return ML_PRINT;
}

static ML_PRINT_RESULT MLOEMControlX(BIT8 *s,  BIT8 chanl, void *param)
{
   U_INT16 indx ;
   U_INT16 msg;
   U_INT16      value;

   if ( !GetOEMCtlPresence((POSITION)(U_INT32)param , chanl)) return ML_NO_PRINT;

   if ( chanl == 7 )
   {
      value = Active_Wkfile.det_cpf_ctl[ (POSITION)(U_INT32)param ].value ;
      msg = MSG_CPF_DET_CONTROL;
   }
   else
   {
      value  = GetOEMCtlPulseLen( (POSITION)(U_INT32)param, chanl ) ;
      indx  = 0;
      if ( GetOEMCtlOnOff((POSITION)(U_INT32)param, chanl ) == ON )  indx += 2 ;
      if (value != 0 ) indx++ ;

      switch ( indx )
      {
         default:
         case 0:
               msg = MSG_CPF_DET_CONTROL_OFF;
               break ;

         case 1:
               msg = ML_CPF_DET_PULS_CONTROL_OFF;
               break ;

         case 2:
               msg = MSG_CPF_DET_CONTROL_ON;
               break ;

         case 3:
               msg = ML_CPF_DET_PULS_CONTROL_ON;
               break ;
      };
   };

   TransferMsg( msg, tmpStr   , GetCPFCtlLabel( (POSITION)(U_INT32)param, chanl ), value );

   ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE);
   return ML_PRINT;
}

static ML_PRINT_RESULT MLCPFControlX(BIT8 *s,  BIT8 chanl, void *param)
{
        U_INT16 msg;
        U_INT16      value;

        if ( !GetCPFCtlPresence((POSITION)(U_INT32)param , chanl)) return ML_NO_PRINT;

        switch (GetCPFCtlFormat((POSITION)(U_INT32)param , chanl) )
        {
          case FRMT_NUMERIC:
          case FRMT_ON_OFF:

               value  = GetCPFCtlValue( (POSITION)(U_INT32)param, chanl );

               if ( GetCPFCtlOnOff( (POSITION)(U_INT32)param, chanl ) == OFF )
               {
                  msg = MSG_CPF_DET_CONTROL_OFF;
               }
               else
               {
                  if ( GetCPFCtlFormat( (POSITION)(U_INT32)param, chanl ) == FRMT_NUMERIC )
                  {
                     /* number */
                     msg = MSG_CPF_DET_CONTROL;
                  }
                  else
                  {
                     /* pure on/off */
                        msg = MSG_CPF_DET_CONTROL_ON;
                  }
               }

               TransferMsg( msg, tmpStr   , GetCPFCtlLabel( (POSITION)(U_INT32)param, chanl ), value );

               break;

          default:
               return ML_NO_PRINT;
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLCPFControl1(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLCPFControlX(s,  1, param);
}

static ML_PRINT_RESULT MLCPFControl2(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLCPFControlX(s,  2, param);
}

static ML_PRINT_RESULT MLCPFControl3(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLCPFControlX(s,  3, param);
}

static ML_PRINT_RESULT MLCPFControl4(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLCPFControlX(s,  4, param);
}

static ML_PRINT_RESULT MLOEMControl1(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  1, param);
}

static ML_PRINT_RESULT MLOEMControl2(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  2, param);
}

static ML_PRINT_RESULT MLOEMControl3(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  3, param);
}

static ML_PRINT_RESULT MLOEMControl4(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  4, param);
}

static ML_PRINT_RESULT MLOEMControl5(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  5, param);
}

static ML_PRINT_RESULT MLOEMControl7(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        return MLOEMControlX(s,  7, param);
}




/************************************************************************/

static ML_PRINT_RESULT MLBackDetTitle(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg;
        BIT8      *title;

        (void) index;
        (void) param;

        if ((BIT8)(BDName[0] != 0))
        {
           /* Use the type label stored in the pneu eeprom */
           TransferMsg( MSG_CPF_BDET_TITLE , s, BDName   );
           return ML_PRINT;
        }

        switch(GetDetectorType(BACK))
        {
        case OEM_AIB:
           title = 2+MessageToString(MSG_DET_OEM_AIB);
           TransferMsg( MSG_CPF_BDET_TITLE , s, title );
           return ML_PRINT;

        case OEM_FID:
           title = 2+MessageToString(MSG_DET_OEM_FID);
           TransferMsg( MSG_CPF_BDET_TITLE , s, title );
           return ML_PRINT;

        case AIB:
                msg = ML_BACK_DET_AIB_TITLE;
                break;

        case ECD:
                msg = ML_BACK_DET_ECD_TITLE;
                break;

        case FID:
                msg =(GetElectrometerType(BACK)) ? ML_BACK_DET_ELECTROMETER_TITLE: ML_BACK_DET_FID_TITLE;
                break;

        case FPD:
                msg = ML_BACK_DET_FPD_TITLE;
                break;

        case NPD:
                msg = ML_BACK_DET_NPD_TITLE;
                break;

        case TCD:
                msg = ML_BACK_DET_TCD_TITLE;
                break;

        case uECD:
                msg = ML_BACK_DET_uECD_TITLE;
                break;

        default:
                msg = ML_BACK_DET_NOT_INSTALLED;
                break;
        }

        TransferMsg( msg , s   );
        return ML_PRINT;

}

/************************************************************************/

static ML_PRINT_RESULT MLSig1Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_SIG_TITLE, s, (INT32)1);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSig2Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_SIG_TITLE, s, (INT32)2);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSigType(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg(GetSignalTypeMsg(param), tmpStr, GetSignalType(pSIGNAL1));
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSigZero(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if ( GetSignalZeroOnOff(param) == ON )
        {
                TransferMsg(GetSignalZeroMsg(param), tmpStr, GetDisplayedSignalZero(pSIGNAL1));
        }
        else
        {
                TransferMsg(SIGNAL_ZERO_OFF_MSG, tmpStr);
        }
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSigRange(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        TransferMsg(ML_SIGNAL_RANGE_MSG, tmpStr, GetSignalRange(param));
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLSigAttn(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if ( GetAttnOnOff(param) == ON )
        {
                TransferMsg(ML_SIGNAL_ATTN_MSG, tmpStr, GetSignalAttn(param));
        }
        else
        {
                TransferMsg(ML_SIGNAL_ATTN_OFF_MSG, tmpStr);
        }
        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

/************************************************************************/

static ML_PRINT_RESULT MLColComp1Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetSccDataState(pCCOMP1) == DATA_OK)
        {
                TransferMsg(ML_COL_COMP_TITLE, s, (INT32)1);
        }
        else
        {
                TransferMsg(ML_COL_COMP_NO_DATA, s, (INT32)1);
        }

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColComp2Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (GetSccDataState(pCCOMP2) == DATA_OK)
        {
                TransferMsg(ML_COL_COMP_TITLE, s, (INT32)2);
        }
        else
        {
                TransferMsg(ML_COL_COMP_NO_DATA, s, (INT32)2);
        }

        return ML_PRINT;
}

static ML_PRINT_RESULT MLColCompDetector(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (GetSccDataState(param) == DATA_OK)
        {
                TransferMsg( (GetSccSignalType(param) == FRONT) ? ML_COL_COMP_FRNT_DETECTOR : ML_COL_COMP_BACK_DETECTOR, tmpStr);
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static void GetAuxTitle(BIT8 *s, INT16 aux_num )
{
   U_INT16 msg;

   switch ( GetAuxType( (U_INT16)aux_num ) )
   {
   case VLV_BOX:
      msg = ML_AUX_VLV_TITLE;
      break;

   case MSD_AUX:
      msg = ML_AUX_MSD_TITLE;
      break;

   case AED_AUX:
      msg = ML_AUX_AED_TITLE ;
      break;

   case CRYO_TRAP:
      msg = ML_AUX_CFO_TITLE;
      break;

   case NIC_CAT:
      msg = ML_AUX_NIC_TITLE;
      break;

   case FPD_AUX:
      msg = ML_AUX_FPD_TITLE;
      break;

   default:
   case UNKNOWN_AUX:
      msg = ML_AUX_TITLE;
      break;
   }

   TransferMsg(msg, s, (INT16)aux_num );

}


static ML_PRINT_RESULT MLAux1Title(BIT8 *s, U_INT8 index, void *param)
{

        (void) index;
        (void) param;

        GetAuxTitle( s, (INT16)1);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLAux2Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        GetAuxTitle( s, (INT16)2);
        return ML_PRINT;
}

/************************************************************************/

static ML_PRINT_RESULT MLAux3Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_AUX_TITLE, s, (INT32)3);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLAux4Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_AUX_TITLE, s, (INT32)4);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLAux5Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_AUX_TITLE, s, (INT32)5);
        return ML_PRINT;
}

static BIT8 AuxIsColumnSource(pAUX_STATUS aux)
{
   if ( (aux->Position == GetColumnSource(pCOLUMN_1)) || (aux->Position == GetColumnSource(pCOLUMN_2)) )
   {
      return TRUE;
   }
   else
   {
      return FALSE;
   }
}

static INT32 AuxColNum(pAUX_STATUS aux)
{
        return (aux->Position == GetColumnSource(pCOLUMN_1)) ? (INT32)1 : (INT32)2;
}

static ML_PRINT_RESULT MLAuxInitTime(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PneuAuxPresent() && !AuxIsColumnSource(param))
        {
                TransferMsg(ML_INIT_TIME, tmpStr, GetAuxPresInitTime(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLAuxInitPres(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PneuAuxPresent())
        {
                if (GetAuxState(param) == ON)
                {
                        MLDoPressure(tmpStr, GetAuxInitPres(param));
                }
                else
                {
                        TransferMsg(ML_PRESSURE_OFF, tmpStr);
                }
        }
        else
        {
                TransferMsg(ML_PRESSURE_NOT_INSTALLED, tmpStr);
        }

        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLAuxCol(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PneuAuxPresent() && AuxIsColumnSource(param))
        {
                TransferMsg(ML_NO_AUX_RAMP, tmpStr, AuxColNum(param));
                ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLAuxRampTitle(BIT8 *s, U_INT8 index, void *param)
{
        INT32 aux;

        (void) index;

        if (PneuAuxPresent() && !AuxIsColumnSource(param))
        {
                if (param == &Inst_Status.Pneu.Aux.Aux_3)
                {
                        aux = 3;
                }
                else if (param == &Inst_Status.Pneu.Aux.Aux_4)
                {
                        aux = 4;
                }
                else
                {
                        aux = 5;
                }

                TransferMsg(ML_AUX_PRES_RAMP_TITLE, s, aux);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLAuxRampHead(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PneuAuxPresent() && !AuxIsColumnSource(param))
        {
                TransferMsg(ML_PRES_RAMP_HEAD, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLAuxRampHeadUL(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;

        if (PneuAuxPresent() && !AuxIsColumnSource(param))
        {
                TransferMsg(ML_PRES_RAMP_HEAD_UL, s);
                return ML_PRINT;
        }
        else
        {
                return ML_NO_PRINT;
        }
}

static ML_PRINT_RESULT MLAuxRamp(BIT8 *s, U_INT8 index, void *param)
{
        INT32 rate, pres, time;

        if (PneuAuxPresent() && !AuxIsColumnSource(param))
        {
                if (index > RAMP_LEVELS)
                {
                        return ML_NO_PRINT;             /* max ramps exceeded */
                }
                else if ((rate = GetAuxPresRate(param, index)) == 0)
                {
                        if ( (index > 1) && (GetAuxPresRate(param, index - 1) == 0) )
                        {
                                return ML_NO_PRINT;     /* we stop printing after the first zero ramp */
                        }
                        else
                        {
                                TransferMsg(ML_PRES_RAMP_OFF, s, index, rate);
                                return ML_PRINT;        /* this is the last ramp line */
                        }
                }
                else
                {
                        pres = GetAuxPresFinalVal(param, index);
                        time = GetAuxPresFinalTime(param, index);
                        TransferMsg(ML_PRES_RAMP, s, index, rate, pres, time);
                        return ML_PRINT_LOOP;           /* more lines may follow */
                }
        }
        else
        {
                return ML_NO_PRINT;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLRunTableTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_RUN_TABLE_TITLE, s);
        return ML_PRINT;
}

static ML_PRINT_RESULT MLRunTableLine(BIT8 *s, U_INT8 index, void *param)
{
        INT32 time;
        U_INT8 type;
        INT32 parm;

        (void) param;

        /* adjust index to be "0, 1, 2, ..." instead of "1, 2, 3, ..." */
        index--;

        if (GetTimeTableEntry(1 + (index / 3), &time, &type, &parm) != OK)
        {
                if (index == 0)
                {
                        TransferMsg(ML_NO_ENTRIES, s);
                        return ML_PRINT;
                }
                else
                {
                        return ML_NO_PRINT;
                }
        }
        else
        {
                switch (index % 3)
                {
                case 0:
                        TransferMsg (ML_TIME_TABLE_TIME, tmpStr, time);
                        ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', FALSE);
                        break;
                case 1:
                        TypeLine (type, tmpStr);
                        ExpandString(tmpStr, s, COL_WIDTH, 2 * COL_INDENT, '.', FALSE);
                        break;
                case 2:
                        ValueLine (type, parm, tmpStr);
                        ExpandString(tmpStr, s, COL_WIDTH, 2 * COL_INDENT, '.', FALSE);
                        break;
                }

                return ML_PRINT_LOOP;
        }
}

/************************************************************************/

static ML_PRINT_RESULT MLValveTitle(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        TransferMsg(ML_VALVE_TITLE, s);
        return ML_PRINT;
}

#define NUM_SUBINDEX 5  /* subindexes are 0..4 */

static ML_PRINT_RESULT MLValveLine(BIT8 *s, U_INT8 index, void *param)
{
        U_INT16 msg, valve, subindex;
        INT32 value1, value2;
        BIT8 singleValue = TRUE;                /* default identifier is single word */
        ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */

        (void) param;

#ifdef _lint
        msg = 0;
        value2 = 0;
#endif

        index--;                                /* work with index = 0, 1, 2, ... */
        valve = 1 + (index / NUM_SUBINDEX);
        subindex = index % NUM_SUBINDEX;
        value1 = valve;                         /* default is valve # */

        if (valve <= 8)
        {
                switch (GetValveType (valve))
                {
                case NO_VALVE:
                        switch (subindex)
                        {
                        case 0:
                                msg = ML_NO_VALVE;
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;

                case MULTIPOSITION:
                        switch (subindex)
                        {
                        case 0:
                                msg = ML_MULTI_VALVE;
                                value2 = GetValveStreamNo();
                                break;

                        case 1:
                                msg = ML_VALVE_SWITCH_TIME;
                                value1 = GetMultiTime();
                                break;

                        case 2:
                                msg = (GetInvertBcd() == ON) ? ML_INVERT_LOGIC_ON : ML_INVERT_LOGIC_OFF;
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;

                case GAS_SAMPLING:
                        switch (subindex)
                        {
                        case 0:
                                msg = (GetValveState(valve) == ON) ? ML_GSV_VALVE_ON : ML_GSV_VALVE_OFF;
                                break;

                        case 1:
                                msg = ML_VALVE_LOOP_VOLUME;
                                value1 = GetValveLoopVolume(valve);
                                break;

                        case 2:
                                msg = ML_VALVE_LOAD_TIME;
                                value1 = GetValveLoadTime(valve);
                                break;

                        case 3:
                                msg = ML_VALVE_INJECT_TIME;
                                value1 = GetValveInjectTime(valve);
                                break;

                        case 4:
                                msg = ML_INLET_AUX;
                                singleValue = FALSE;

                                switch(GetValveInlet(valve))
                                {
                                case FRONT_INJ:
                                        msg = ML_INLET_FRONT;
                                        break;

                                case BACK_INJ:
                                        msg = ML_INLET_BACK;
                                        break;

                                case AUX3:
                                        value1 = 3;
                                        break;

                                case AUX4:
                                        value1 = 4;
                                        break;

                                case AUX5:
                                        value1 = 5;
                                        break;

                                default:
                                case NO_CONNECTION:
                                        msg = ML_VALVE_INLET_NONE;
                                        break;
                                }
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;

                case REMOTE_START:
                        switch (subindex)
                        {
                        case 0:
                                msg = ML_REMOTE_STRT_VALVE;
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;

                case SELECTION:
                        switch (subindex)
                        {
                        case 0:
                                msg = (GetValveState(valve) == ON) ? ML_SELECT_VALVE_ON : ML_SELECT_VALVE_OFF;
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;

                case OTHER:
                default:
                        switch (subindex)
                        {
                        case 0:
                                msg = (GetValveState(valve) == ON) ? ML_VALVE_ON : ML_VALVE_OFF;
                                break;

                        default:
                                retval = ML_NO_PRINT_LOOP;
                                break;
                        }
                        break;
                }
        }
        else
        {
                retval = ML_NO_PRINT;
        }

        if (retval == ML_PRINT_LOOP)
        {
                TransferMsg (msg, tmpStr, value1, value2);
                ExpandString(tmpStr, s, COL_WIDTH, (subindex == 0) ? COL_INDENT : (2 * COL_INDENT), '.', singleValue);
        }
        return retval;
}

/************************************************************************/

static ML_PRINT_RESULT MLInj1Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (AnyFrAlsInjector())
        {
                TransferMsg(ML_FRONT_INJ_TITLE, s);
                return ML_PRINT;
        }
        else
        {
                TransferMsg(ML_FRONT_INJ_NOT_INSTALLED, s);
                return ML_PRINT;
        }
}

static ML_PRINT_RESULT MLInj1(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   INT32 value;
   BIT8 singleValue = TRUE;                /* default identifier is single word */
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */

   (void) param;

   value = 0;

   if (AnyFrAlsInjector())
   {
      switch (index)
      {
      case 1:
         if (GetSyringeSize(FRONT) > 0)
         {
            if (GetAlsVolStop(FRONT) > 1)
            {
               value = (INT32) (GetSyringeSize(FRONT) * ((INT32)GetAlsVolStop(FRONT) - 1));
               if (value >= 10)
               {
                  value = value/10;
                  msg = ML_TWR_VOL;
               }
               else
               {
                  msg = ML_TWR_VOL2;
               }
            }
            else
            {
               msg = ML_TWR_VOL2;
               value = (INT32) (GetSyringeSize(FRONT) * 2)/10;
            }

            singleValue = FALSE;
         }
         else
         {
            msg = ML_TWR_VOL_STOP;
            value = (INT32) GetAlsVolStop(FRONT);
         }
         break;

      case 2:
         msg = ML_TWR_PUMPS;
         value = (INT32) GetAlsPumps(FRONT);
         break;

      case 3:
         msg = ML_TWR_VISC;
         value = (INT32) GetAlsViscosity(FRONT);
         singleValue = FALSE;
         break;

      case 4:
         msg = ML_TWR_SAMP_WASH;
         value = (INT32) GetAlsSampWash(FRONT);
         break;

      case 5:
         msg = ML_TWR_POST_WASH_A;
         value = (INT32) GetAlsPostWashA(FRONT);
         break;

      case 6:
         msg = ML_TWR_POST_WASH_B;
         value = (INT32) GetAlsPostWashB(FRONT);
         break;

      case 7:
         msg = ML_TWR_SLOW_PLUNGER_ON;
         if (GetSlowPlunger(FRONT) == 0) msg = ML_TWR_SLOW_PLUNGER_OFF;
         break;

      case 8:
         msg = ML_TWR_PRE_DWELL;
         value = (INT32) GetAlsPreDwell(FRONT);
         singleValue = FALSE;
         break;

      case 9:
         msg = ML_TWR_POST_DWELL;
         value = (INT32) GetAlsPostDwell(FRONT);
         singleValue = FALSE;
         break;

      case 10:
         if (GetSkimEnabled(FRONT) == 0)
         {
            msg = ML_TWR_SAMP_SKIM_OFF;
            break;
         }
         else
         {
            msg = ML_TWR_SAMP_SKIM;
            value = (INT32) GetSkimDepth(FRONT);
            singleValue = FALSE;
            break;
         }

      case 11:
         msg = ML_TWR_PRE_WASH_A;
         value = (INT32) GetAlsPreWashA(FRONT);
         break;

      case 12:
         msg = ML_TWR_PRE_WASH_B;
         value = (INT32) GetAlsPreWashB(FRONT);
         break;

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr, value);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', singleValue);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

static ML_PRINT_RESULT MLInj1Config(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   BIT8 singleValue = TRUE;                /* default identifier is single word */
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */
   INT32 value;

   (void) param;

   value = 0;

   if (AnyFrAlsInjector())
   {
      if ((TurretSupportsExtendSolvent(FRONT) == FALSE) && (index >= 2)) index++;
      if ((TurretSupportsWasteMode(FRONT) == FALSE) && (index >= 3)) index++;
      switch (index)
      {
      case 1:
         if (TowersSwapped())
         {
            msg = ML_TWR_FRONT_INJ_2;
            singleValue = FALSE;
            break;
         }
         else
         {
            msg = ML_TWR_FRONT_INJ_1;
            singleValue = FALSE;
            break;
         }

      case 2:
         if (GetExtendSolv(FRONT))
         {
            msg = ML_TWR_EXTEND_SOLV_ON;
            break;
         }
         else
         {
            msg = ML_TWR_EXTEND_SOLV_OFF;
            break;
         }

      case 3:
         msg = ML_TWR_WASTE_USE_BOTH;
         if (GetAlsWasteMode(FRONT) == 0) msg = ML_TWR_WASTE_USE_A;
         if (GetAlsWasteMode(FRONT) == 1) msg = ML_TWR_WASTE_USE_B;
         break;

      case 4:
         value = GetSyringeSize(FRONT);
         msg = ML_TWR_SYRINGE_SIZE;
         singleValue = FALSE;
         break;

      case 5:
         msg = ML_TWR_FAN_ON;
         if (GetAlsFanOnOff(FRONT) == 0) msg = ML_TWR_FAN_OFF;
         break;

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr, value);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', singleValue);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

static ML_PRINT_RESULT MLInj2Title(BIT8 *s, U_INT8 index, void *param)
{
        (void) index;
        (void) param;

        if (AnyBkAlsInjector())
        {
                TransferMsg(ML_BACK_INJ_TITLE, s);
                return ML_PRINT;
        }
        else
        {
                TransferMsg(ML_BACK_INJ_NOT_INSTALLED, s);
                return ML_PRINT;
        }
}

static ML_PRINT_RESULT MLInj2(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   INT32 value;
   BIT8 singleValue = TRUE;                /* default identifier is single word */
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */

   (void) param;

   value = 0;

   if (AnyBkAlsInjector())
   {
      switch (index)
      {
      case 1:
         if (GetSyringeSize(BACK) > 0)
         {
            if (GetAlsVolStop(BACK) > 1)
            {
               value = (INT32) (GetSyringeSize(BACK) * ((INT32)GetAlsVolStop(BACK) - 1));
               if (value >= 10)
               {
                  value = value/10;
                  msg = ML_TWR_VOL;
               }
               else
               {
                  msg = ML_TWR_VOL2;
               }
            }
            else
            {
               msg = ML_TWR_VOL2;
               value = (INT32) (GetSyringeSize(BACK) * 2)/10;
            }

            singleValue = FALSE;
         }
         else
         {
            msg = ML_TWR_VOL_STOP;
            value = (INT32) GetAlsVolStop(BACK);
         }
         break;

      case 2:
         msg = ML_TWR_PUMPS;
         value = (INT32) GetAlsPumps(BACK);
         break;

      case 3:
         msg = ML_TWR_VISC;
         value = (INT32) GetAlsViscosity(BACK);
         singleValue = FALSE;
         break;

      case 4:
         msg = ML_TWR_SAMP_WASH;
         value = (INT32) GetAlsSampWash(BACK);
         break;

      case 5:
         msg = ML_TWR_POST_WASH_A;
         value = (INT32) GetAlsPostWashA(BACK);
         break;

      case 6:
         msg = ML_TWR_POST_WASH_B;
         value = (INT32) GetAlsPostWashB(BACK);
         break;

      case 7:
         msg = ML_TWR_SLOW_PLUNGER_ON;
         if (GetSlowPlunger(BACK) == 0) msg = ML_TWR_SLOW_PLUNGER_OFF;
         break;

      case 8:
         msg = ML_TWR_PRE_DWELL;
         value = (INT32) GetAlsPreDwell(BACK);
         singleValue = FALSE;
         break;

      case 9:
         msg = ML_TWR_POST_DWELL;
         value = (INT32) GetAlsPostDwell(BACK);
         singleValue = FALSE;
         break;

      case 10:
         if (GetSkimEnabled(BACK) == 0)
         {
            msg = ML_TWR_SAMP_SKIM_OFF;
            break;
         }
         else
         {
            msg = ML_TWR_SAMP_SKIM;
            value = (INT32) GetSkimDepth(BACK);
            singleValue = FALSE;
            break;
         }

      case 11:
         msg = ML_TWR_PRE_WASH_A;
         value = (INT32) GetAlsPreWashA(BACK);
         break;

      case 12:
         msg = ML_TWR_PRE_WASH_B;
         value = (INT32) GetAlsPreWashB(BACK);
         break;

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr, value);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', singleValue);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

static ML_PRINT_RESULT MLInj2Config(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   BIT8 singleValue = TRUE;                /* default identifier is single word */
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */
   INT32 value;

   (void) param;

   value = 0;

   if (AnyBkAlsInjector())
   {
      switch (index)
      {
      case 1:
         if (TowersSwapped())
         {
            msg = ML_TWR_BACK_INJ_1;
            singleValue = FALSE;
            break;
         }
         else
         {
            msg = ML_TWR_BACK_INJ_2;
            singleValue = FALSE;
            break;
         }

      case 2:
         if (GetExtendSolv(BACK))
         {
            msg = ML_TWR_EXTEND_SOLV_ON;
            break;
         }
         else
         {
            msg = ML_TWR_EXTEND_SOLV_OFF;
            break;
         }

      case 3:
         msg = ML_TWR_WASTE_USE_BOTH;
         if (GetAlsWasteMode(BACK) == 0) msg = ML_TWR_WASTE_USE_A;
         if (GetAlsWasteMode(BACK) == 1) msg = ML_TWR_WASTE_USE_B;
         break;

      case 4:
         value = GetSyringeSize(BACK);
         msg = ML_TWR_SYRINGE_SIZE;
         singleValue = FALSE;
         break;

      case 5:
         msg = ML_TWR_FAN_ON;
         if (GetAlsFanOnOff(BACK) == 0) msg = ML_TWR_FAN_OFF;
         break;

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr, value);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', singleValue);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

static ML_PRINT_RESULT MLTrayTitle(BIT8 *s, U_INT8 index, void *param)
{
   (void) index;
   (void) param;

   if (AnyAlsTray())
   {
      TransferMsg(ML_TRAY_TITLE, s);
      return ML_PRINT;
   }
   else
   {
      TransferMsg(ML_TRAY_NOT_INSTALLED, s);
      return ML_PRINT;
   }
}

static ML_PRINT_RESULT MLTray(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */

   (void) param;

   if (AnyAlsTray())
   {
      switch (index)
      {
      case 1:
         if (GetTrayEnabled())
         {
            msg = ML_TRAY_ON;
            break;
         }
         else
         {
            msg = ML_TRAY_OFF;
            break;
         }

      case 2:
         if (HaveAlsTray() && AnyAlsBCR())
         {
            if (GetBCREnabled())
            {
               msg = ML_BCR_ON;
               break;
            }
            else
            {
               msg = ML_BCR_OFF;
               break;
            }
         }
         else
         {
            retval = ML_NO_PRINT;
            return retval;
         }

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

static ML_PRINT_RESULT MLTrayConfig(BIT8 *s, U_INT8 index, void *param)
{
   U_INT16 msg;
   ML_PRINT_RESULT retval = ML_PRINT_LOOP; /* default return value */
   INT32 value;

   (void) param;

   value = 0;

   if (HaveAlsTray() && AnyAlsBCR())
   {
      switch (index)
      {
      case 1:
         if (GetBCR3of9OnOff())
         {
            msg = ML_3_OF_9_ON;
            break;
         }
         else
         {
            msg = ML_3_OF_9_OFF;
            break;
         }

      case 2:
         if (GetBCR2of5OnOff())
         {
            msg = ML_2_OF_5_ON;
            break;
         }
         else
         {
            msg = ML_2_OF_5_OFF;
            break;
         }

      case 3:
         if (GetBCRUPCOnOff())
         {
            msg = ML_UPC_ON;
            break;
         }
         else
         {
            msg = ML_UPC_OFF;
            break;
         }

      case 4:
         if (GetBCRChecksumOnOff())
         {
            msg = ML_BCR_CHECKSUM_ON;
            break;
         }
         else
         {
            msg = ML_BCR_CHECKSUM_OFF;
            break;
         }

      case 5:
         msg = ML_BCR_POSITION;
         value = GetBCRPosition();
         break;

      default:
         retval = ML_NO_PRINT;
         return retval;
      }

      TransferMsg (msg, tmpStr, value);
      ExpandString(tmpStr, s, COL_WIDTH, COL_INDENT, '.', TRUE);
      return retval;
   }
   else
   {
      return ML_NO_PRINT;
   }
}

/************************************************************************/

static const ML_SECTION NullSection =
{
        {0,                     NULL}
};

static const ML_SECTION TitleSection =
{
        {MLTitle,               NULL},
        {0,                     NULL}
};

static const ML_SECTION OvenSection =
{
        {MLOvenTitle,           NULL},
        {MLTemp,                pOVEN_TEMP},
        {MLDoTempInitTime,      pOVEN_TEMP},
        {MLOvenMax,             NULL},
        {MLOvenEquib,           NULL},

        {MLCryoTitle,           pOVEN_TEMP},
        {MLCryoFault,           pOVEN_TEMP},
        {MLCryoTimeout,         pOVEN_TEMP},
        {MLCryoQuickCool,       pOVEN_TEMP},
        {MLCryoAmbient,         pOVEN_TEMP},
        {0,                     NULL}
};

static const ML_SECTION OvenRampSection =
{
        {MLRampTitle,           pOVEN_TEMP},
        {MLRampHead,            pOVEN_TEMP},
        {MLRampHeadUL,          pOVEN_TEMP},
        {MLOvenRamp,            pOVEN_TEMP},
        {0,                     NULL}
};

static const ML_SECTION FrntPPInletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {0,                     NULL}
};

static const ML_SECTION FrntSSInletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {0,                     NULL}
};

static const ML_SECTION FrntCOCInletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLInletTempMode,       pFRONT_INLET_TEMP},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLCOCInitTime,         pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {MLCOCRampTitle,        pFRONT_INLET_TEMP},
        {MLCOCRampHead,         pFRONT_INLET_TEMP},
        {MLCOCRampHeadUL,       pFRONT_INLET_TEMP},
        {MLCOCRamp,             pFRONT_INLET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION FrntSIMDISTInletSection =
{
        {MLFrntInletTitle,      NULL},
/*      {MLInletTempMode,       pFRONT_INLET_TEMP},  */
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLCOCInitTime,         pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {MLSZCryoTitle,         pFRONT_INLET_TEMP},
        {MLSZCryoTemp,          pFRONT_INLET_TEMP},
        {MLSZCryoTimeout,       pFRONT_INLET_TEMP},
        {MLSZCryoFault,         pFRONT_INLET_TEMP},
        {MLCOCRampTitle,        pFRONT_INLET_TEMP},
        {MLCOCRampHead,         pFRONT_INLET_TEMP},
        {MLCOCRampHeadUL,       pFRONT_INLET_TEMP},
        {MLCOCRamp,             pFRONT_INLET_TEMP},
        {0,                     NULL}
};

/* REVISIT - no PTV in IQ1 - this is just a stub */
static const ML_SECTION FrntPTVInletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {0,                     NULL}
};

static const ML_SECTION FrntCIS3InletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentPres,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentFlow,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentTime,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {0,                     NULL}
};

static const ML_SECTION FrntCIS4InletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLCOCInitTime,         pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentPres,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentFlow,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLCISxVentTime,        &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {MLSZCryoTitle,         pFRONT_INLET_TEMP},
        {MLSZCryoTemp,          pFRONT_INLET_TEMP},
        {MLSZCryoTimeout,       pFRONT_INLET_TEMP},
        {MLSZCryoFault,         pFRONT_INLET_TEMP},
        {MLCOCRampTitle,        pFRONT_INLET_TEMP},
        {MLCOCRampHead,         pFRONT_INLET_TEMP},
        {MLCOCRampHeadUL,       pFRONT_INLET_TEMP},
        {MLCOCRamp,             pFRONT_INLET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION FrntVIInletSection =
{
        {MLFrntInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Frnt_Inlet},
        {MLVISmplgEnd,          &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Frnt_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Frnt_Inlet},
        {MLSplitVentCfg,        &Inst_Status.Pneu.Frnt_Inlet},
        {0,                     NULL}
};

static const ML_SECTION BackVIInletSection =
{
        {MLBackInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Back_Inlet},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLVISmplgEnd,          &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {MLSplitVentCfg,        &Inst_Status.Pneu.Back_Inlet},
        {0,                     NULL}
};


static const ML_SECTION BackPPInletSection =
{
        {MLBackInletTitle,      NULL},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {0,                     NULL}
};

static const ML_SECTION BackSSInletSection =
{
        {MLBackInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Back_Inlet},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {0,                     NULL}
};

static const ML_SECTION BackCOCInletSection =
{
        {MLBackInletTitle,      NULL},
        {MLInletTempMode,       pBACK_INLET_TEMP},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLCOCInitTime,         pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {MLCOCRampTitle,        pBACK_INLET_TEMP},
        {MLCOCRampHead,         pBACK_INLET_TEMP},
        {MLCOCRampHeadUL,       pBACK_INLET_TEMP},
        {MLCOCRamp,             pBACK_INLET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION BackSIMDISTInletSection =
{
        {MLBackInletTitle,      NULL},
/*      {MLInletTempMode,       pBACK_INLET_TEMP}, */
        {MLTemp,                pBACK_INLET_TEMP},
        {MLCOCInitTime,         pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {MLSZCryoTitle,         pBACK_INLET_TEMP},
        {MLSZCryoTemp,          pBACK_INLET_TEMP},
        {MLSZCryoTimeout,       pBACK_INLET_TEMP},
        {MLSZCryoFault,         pBACK_INLET_TEMP},
        {MLCOCRampTitle,        pBACK_INLET_TEMP},
        {MLCOCRampHead,         pBACK_INLET_TEMP},
        {MLCOCRampHeadUL,       pBACK_INLET_TEMP},
        {MLCOCRamp,             pBACK_INLET_TEMP},
        {0,                     NULL}
};

/* REVISIT - no PTV in IQ1 - this is just a stub */
static const ML_SECTION BackPTVInletSection =
{
        {MLBackInletTitle,      NULL},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {0,                     NULL}
};

static const ML_SECTION BackCIS3InletSection =
{
        {MLBackInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Back_Inlet},
        {MLTemp,                pFRONT_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentPres,        &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentFlow,        &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentTime,        &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {0,                     NULL}
};

static const ML_SECTION BackCIS4InletSection =
{
        {MLBackInletTitle,      NULL},
        {MLInletMode,           &Inst_Status.Pneu.Back_Inlet},
        {MLTemp,                pBACK_INLET_TEMP},
        {MLCOCInitTime,         pBACK_INLET_TEMP},
        {MLInletPres,           &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentPres,        &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentFlow,        &Inst_Status.Pneu.Back_Inlet},
        {MLCISxVentTime,        &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulsePres,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPulseTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitRatio,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSplitFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletPurgeFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletTotalFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverOnOff,     &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverFlow,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletSaverTime,      &Inst_Status.Pneu.Back_Inlet},
        {MLInletGas,            &Inst_Status.Pneu.Back_Inlet},
        {MLSZCryoTitle,         pBACK_INLET_TEMP},
        {MLSZCryoTemp,          pBACK_INLET_TEMP},
        {MLSZCryoTimeout,       pBACK_INLET_TEMP},
        {MLSZCryoFault,         pBACK_INLET_TEMP},
        {MLCOCRampTitle,        pBACK_INLET_TEMP},
        {MLCOCRampHead,         pBACK_INLET_TEMP},
        {MLCOCRampHeadUL,       pBACK_INLET_TEMP},
        {MLCOCRamp,             pBACK_INLET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION Column1Section =
{
        {MLCol1Title,           NULL},
        /* setpoints under "CONFIG COL n" key */
        {MLColLength,           &Inst_Status.Pneu.Column_1},
        {MLColDiameter,         &Inst_Status.Pneu.Column_1},
        {MLColFilmThickness,    &Inst_Status.Pneu.Column_1},
        {MLColInlet,            &Inst_Status.Pneu.Column_1},
        {MLColDetector,         &Inst_Status.Pneu.Column_1},
        {MLColVacuumCorrect,    &Inst_Status.Pneu.Column_1},
        {MLColPresCorrect,      &Inst_Status.Pneu.Column_1},
        /* setpoints under "COL n" key */
        {MLColPressure,         &Inst_Status.Pneu.Column_1},
        {MLColFlow,             &Inst_Status.Pneu.Column_1},
        {MLColAvgVelocity,      &Inst_Status.Pneu.Column_1},
        {MLColMode,             &Inst_Status.Pneu.Column_1},

        {MLColFlowInitTime,     &Inst_Status.Pneu.Column_1},
        {MLColFlowRampTitle,    &Inst_Status.Pneu.Column_1},
        {MLColFlowRampHead,     &Inst_Status.Pneu.Column_1},
        {MLColFlowRampHeadUL,   &Inst_Status.Pneu.Column_1},
        {MLColFlowRamp,         &Inst_Status.Pneu.Column_1},

        {MLColPresInitTime,     &Inst_Status.Pneu.Column_1},
        {MLColPresRampTitle,    &Inst_Status.Pneu.Column_1},
        {MLColPresRampHead,     &Inst_Status.Pneu.Column_1},
        {MLColPresRampHeadUL,   &Inst_Status.Pneu.Column_1},
        {MLColPresRamp,         &Inst_Status.Pneu.Column_1},
        {0,                     NULL}
};

static const ML_SECTION Column2Section =
{
        {MLCol2Title,           NULL},
        /* setpoints under "CONFIG COL n" key */
        {MLColLength,           &Inst_Status.Pneu.Column_2},
        {MLColDiameter,         &Inst_Status.Pneu.Column_2},
        {MLColFilmThickness,    &Inst_Status.Pneu.Column_2},
        {MLColInlet,            &Inst_Status.Pneu.Column_2},
        {MLColDetector,         &Inst_Status.Pneu.Column_2},
        {MLColVacuumCorrect,    &Inst_Status.Pneu.Column_2},
        {MLColPresCorrect,      &Inst_Status.Pneu.Column_2},
        /* setpoints under "COL n" key */
        {MLColPressure,         &Inst_Status.Pneu.Column_2},
        {MLColFlow,             &Inst_Status.Pneu.Column_2},
        {MLColAvgVelocity,      &Inst_Status.Pneu.Column_2},
        {MLColMode,             &Inst_Status.Pneu.Column_2},

        {MLColFlowInitTime,     &Inst_Status.Pneu.Column_2},
        {MLColFlowRampTitle,    &Inst_Status.Pneu.Column_2},
        {MLColFlowRampHead,     &Inst_Status.Pneu.Column_2},
        {MLColFlowRampHeadUL,   &Inst_Status.Pneu.Column_2},
        {MLColFlowRamp,         &Inst_Status.Pneu.Column_2},

        {MLColPresInitTime,     &Inst_Status.Pneu.Column_2},
        {MLColPresRampTitle,    &Inst_Status.Pneu.Column_2},
        {MLColPresRampHead,     &Inst_Status.Pneu.Column_2},
        {MLColPresRampHeadUL,   &Inst_Status.Pneu.Column_2},
        {MLColPresRamp,         &Inst_Status.Pneu.Column_2},
        {0,                     NULL}
};

static const ML_SECTION FrntDetAIBSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTempCPF,             pFRONT_DET_TEMP},
        {MLDetElectrometer,     (void *)FRONT},
        {MLCPFControl1,         (void *)FRONT},
        {MLCPFControl2,         (void *)FRONT},
        {MLCPFControl3,         (void *)FRONT},
        {MLCPFControl4,         (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetECDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetAnodeGas,         &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetECDTargetOffset,  (void *)FRONT},
        {MLDetElectrometer,     (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetFIDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Frnt_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetFlame,            (void *)FRONT},
        {MLDetFIDLitOffset,     (void *)FRONT},
        {MLDetElectrometer,     (void *)FRONT},
        {MLCPFControl1,         (void *)FRONT},
        {MLCPFControl2,         (void *)FRONT},
        {MLCPFControl3,         (void *)FRONT},
        {MLCPFControl4,         (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetFPDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Frnt_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetFlame,            (void *)FRONT},
        {MLDetFPDLitOffset,     (void *)FRONT},
        {MLDetElectrometer,     (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetNPDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Frnt_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetBeadOnOff,        (void *)FRONT},
        {MLDetNPDTargetOffset,  (void *)FRONT},
        {MLDetEquibTime,        (void *)FRONT},
        {MLDetElectrometer,     (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetTCDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetRefGas,           &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetFilamentOnOff,    (void *)FRONT},
        {MLDetNegPolarityOnOff, (void *)FRONT},
        {0,                     NULL}
};
static const ML_SECTION FrntDeTuECDSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetElectrometer,     (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntCPFDetSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTempCPF,             pFRONT_DET_TEMP},
        {MLCPFDetGas1,          &Inst_Status.Pneu.Frnt_Detector},
        {MLCPFDetGas2,          &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Frnt_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Frnt_Detector},
        {MLDetElectrometer,     (void *)FRONT},
        {MLCPFControl1,         (void *)FRONT},
        {MLCPFControl2,         (void *)FRONT},
        {MLCPFControl3,         (void *)FRONT},
        {MLCPFControl4,         (void *)FRONT},
        {0,                     NULL}
};

static const ML_SECTION FrntDetOEMSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTempCPF,             pFRONT_DET_TEMP},
        {MLCPFDetGas1,          &Inst_Status.Pneu.Frnt_Detector},
        {MLCPFDetGas2,          &Inst_Status.Pneu.Frnt_Detector},
        {MLOEMDetGas3,          &Inst_Status.Pneu.Frnt_Detector},
        {MLDetElectrometer,     (void *)FRONT},
        {MLOEMControl1,         (void *)FRONT},
        {MLOEMControl2,         (void *)FRONT},
        {MLOEMControl3,         (void *)FRONT},
        {MLOEMControl4,         (void *)FRONT},
        {MLOEMControl5,         (void *)FRONT},
        {MLOEMControl7,         (void *)FRONT},
        {MLOEMDetGas1Type,      &Inst_Status.Pneu.Frnt_Detector},
        {MLOEMDetGas2Type,      &Inst_Status.Pneu.Frnt_Detector},
        {MLOEMDetGas3Type,      &Inst_Status.Pneu.Frnt_Detector},
        {0,                     NULL}
};

static const ML_SECTION FrntDetNotInstalledSection =
{
        {MLFrntDetTitle,        NULL},
        {MLTemp,                pFRONT_DET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION BackDetAIBSection =
{
        {MLBackDetTitle,        NULL},
        {MLTempCPF,             pBACK_DET_TEMP},
        {MLDetElectrometer,     (void *)BACK},
        {MLCPFControl1,         (void *)BACK},
        {MLCPFControl2,         (void *)BACK},
        {MLCPFControl3,         (void *)BACK},
        {MLCPFControl4,         (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetECDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetAnodeGas,         &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetECDTargetOffset,  (void *)BACK},
        {MLDetElectrometer,     (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetFIDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Back_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetFlame,            (void *)BACK},
        {MLDetFIDLitOffset,     (void *)BACK},
        {MLDetElectrometer,     (void *)BACK},
        {MLCPFControl1,         (void *)BACK},
        {MLCPFControl2,         (void *)BACK},
        {MLCPFControl3,         (void *)BACK},
        {MLCPFControl4,         (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetFPDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Back_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetFlame,            (void *)BACK},
        {MLDetFPDLitOffset,     (void *)BACK},
        {MLDetElectrometer,     (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetNPDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetH2Gas,            &Inst_Status.Pneu.Back_Detector},
        {MLDetAirGas,           &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetBeadOnOff,        (void *)BACK},
        {MLDetNPDTargetOffset,  (void *)BACK},
        {MLDetEquibTime,        (void *)BACK},
        {MLDetElectrometer,     (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetTCDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetRefGas,           &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetFilamentOnOff,    (void *)BACK},
        {MLDetNegPolarityOnOff, (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDeTuECDSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetElectrometer,     (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackCPFDetSection =
{
        {MLBackDetTitle,        NULL},
        {MLTempCPF,             pBACK_DET_TEMP},
        {MLCPFDetGas1,          &Inst_Status.Pneu.Back_Detector},
        {MLCPFDetGas2,          &Inst_Status.Pneu.Back_Detector},
        {MLDetMode,             &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGas,        &Inst_Status.Pneu.Back_Detector},
        {MLDetMakeupGasType,    &Inst_Status.Pneu.Back_Detector},
        {MLDetElectrometer,     (void *)BACK},
        {MLCPFControl1,         (void *)BACK},
        {MLCPFControl2,         (void *)BACK},
        {MLCPFControl3,         (void *)BACK},
        {MLCPFControl4,         (void *)BACK},
        {0,                     NULL}
};

static const ML_SECTION BackDetOEMSection =
{
        {MLBackDetTitle,        NULL},
        {MLTempCPF,             pBACK_DET_TEMP},
        {MLCPFDetGas1,          &Inst_Status.Pneu.Back_Detector},
        {MLCPFDetGas2,          &Inst_Status.Pneu.Back_Detector},
        {MLOEMDetGas3,          &Inst_Status.Pneu.Back_Detector},
        {MLDetElectrometer,     (void *)BACK },
        {MLOEMControl1,         (void *)BACK },
        {MLOEMControl2,         (void *)BACK },
        {MLOEMControl3,         (void *)BACK },
        {MLOEMControl4,         (void *)BACK },
        {MLOEMControl5,         (void *)BACK },
        {MLOEMControl7,         (void *)BACK },
        {MLOEMDetGas1Type,      &Inst_Status.Pneu.Back_Detector},
        {MLOEMDetGas2Type,      &Inst_Status.Pneu.Back_Detector},
        {MLOEMDetGas3Type,      &Inst_Status.Pneu.Back_Detector},
        {0,                     NULL}
};

static const ML_SECTION BackDetNotInstalledSection =
{
        {MLBackDetTitle,        NULL},
        {MLTemp,                pBACK_DET_TEMP},
        {0,                     NULL}
};

static const ML_SECTION Sig1Section =
{
        {MLSig1Title,           NULL},
        {MLSigType,             pSIGNAL1},
        {MLSigZero,             pSIGNAL1},
        {MLSigRange,            pSIGNAL1},
        {MLSigAttn,             pSIGNAL1},
        {0,                     NULL}
};

static const ML_SECTION Sig2Section =
{
        {MLSig2Title,           NULL},
        {MLSigType,             pSIGNAL2},
        {MLSigZero,             pSIGNAL2},
        {MLSigRange,            pSIGNAL2},
        {MLSigAttn,             pSIGNAL2},
        {0,                     NULL}
};

static const ML_SECTION ColComp1Section =
{
        {MLColComp1Title,       NULL},
        {MLColCompDetector,     pCCOMP1},
        {0,                     NULL}
};

static const ML_SECTION ColComp2Section =
{
        {MLColComp2Title,       NULL},
        {MLColCompDetector,     pCCOMP2},
        {0,                     NULL}
};

static const ML_SECTION AuxAndRunTableSection =
{
        {MLAux1Title,           NULL},
        {MLTemp,                pAUX_1_TEMP},
        {MLTempInitTime,        pAUX_1_TEMP},
        {MLRampHead,            pAUX_1_TEMP},
        {MLRampHeadUL,          pAUX_1_TEMP},
        {MLRamp,                pAUX_1_TEMP},
        {MLSZCryoTitle,         pAUX_1_TEMP},
/*      {MLSZCryoTemp,          pAUX_1_TEMP},          */
        {MLSZCryoCoolMode,      pAUX_1_TEMP},
        {MLSZCryoTimeout,       pAUX_1_TEMP},
        {MLSZCryoFault,         pAUX_1_TEMP},

        {MLAux2Title,           NULL},
        {MLTemp,                pAUX_2_TEMP},
        {MLTempInitTime,        pAUX_2_TEMP},
        {MLRampHead,            pAUX_2_TEMP},
        {MLRampHeadUL,          pAUX_2_TEMP},
        {MLRamp,                pAUX_2_TEMP},
        {MLSZCryoTitle,         pAUX_2_TEMP},
/*      {MLSZCryoTemp,          pAUX_2_TEMP},          */
        {MLSZCryoCoolMode,      pAUX_2_TEMP},
        {MLSZCryoTimeout,       pAUX_2_TEMP},
        {MLSZCryoFault,         pAUX_2_TEMP},

        {MLAux3Title,           NULL},
        {MLAuxInitPres,         &Inst_Status.Pneu.Aux.Aux_3},
        {MLAuxCol,              &Inst_Status.Pneu.Aux.Aux_3},
        {MLAuxInitTime,         &Inst_Status.Pneu.Aux.Aux_3},

        {MLAuxRampTitle,        &Inst_Status.Pneu.Aux.Aux_3},
        {MLAuxRampHead,         &Inst_Status.Pneu.Aux.Aux_3},
        {MLAuxRampHeadUL,       &Inst_Status.Pneu.Aux.Aux_3},
        {MLAuxRamp,             &Inst_Status.Pneu.Aux.Aux_3},

        {MLAux4Title,           NULL},
        {MLAuxInitPres,         &Inst_Status.Pneu.Aux.Aux_4},
        {MLAuxCol,              &Inst_Status.Pneu.Aux.Aux_4},
        {MLAuxInitTime,         &Inst_Status.Pneu.Aux.Aux_4},

        {MLAuxRampTitle,        &Inst_Status.Pneu.Aux.Aux_4},
        {MLAuxRampHead,         &Inst_Status.Pneu.Aux.Aux_4},
        {MLAuxRampHeadUL,       &Inst_Status.Pneu.Aux.Aux_4},
        {MLAuxRamp,             &Inst_Status.Pneu.Aux.Aux_4},

        {MLAux5Title,           NULL},
        {MLAuxInitPres,         &Inst_Status.Pneu.Aux.Aux_5},
        {MLAuxCol,              &Inst_Status.Pneu.Aux.Aux_5},
        {MLAuxInitTime,         &Inst_Status.Pneu.Aux.Aux_5},

        {MLAuxRampTitle,        &Inst_Status.Pneu.Aux.Aux_5},
        {MLAuxRampHead,         &Inst_Status.Pneu.Aux.Aux_5},
        {MLAuxRampHeadUL,       &Inst_Status.Pneu.Aux.Aux_5},
        {MLAuxRamp,             &Inst_Status.Pneu.Aux.Aux_5},

        {MLRunTableTitle,       NULL},
        {MLRunTableLine,        NULL},
        {0,                     NULL}
};

static const ML_SECTION ValveSection =
{
        {MLValveTitle,          NULL},
        {MLValveLine,           NULL},
        {0,                     NULL}
};

static const ML_SECTION Inj1Section =
{
        {MLInj1Title,           NULL},
        {MLInj1,                NULL},
        {MLInj1Config,          NULL},
        {0,                     NULL}
};

static const ML_SECTION Inj2Section =
{
        {MLInj2Title,           NULL},
        {MLInj2,                NULL},
        {MLInj2Config,          NULL},
        {0,                     NULL}
};

static const ML_SECTION TraySection =
{
        {MLTrayTitle,           NULL},
        {MLTray,                NULL},
        {MLTrayConfig,          NULL},
        {0,                     NULL}
};

/************************************************************************/

static const ML_SECTION_ENTRY * DoNullSection()
{
        return &NullSection[0];
}

static const ML_SECTION_ENTRY * DoTitleSection()
{
        return &TitleSection[0];
}

static const ML_SECTION_ENTRY * DoOvenSection()
{
        return &OvenSection[0];
}

static const ML_SECTION_ENTRY * DoOvenRampSection()
{
        return &OvenRampSection[0];
}

static const ML_SECTION_ENTRY * DoFrntInletSection()
{
        switch(GetInletType(pFRONT_INLET))
        {
        case SS:
        case MANUAL_SS:
                return &FrntSSInletSection[0];

        case COC:
        case MANUAL_COC:
                return &FrntCOCInletSection[0];

        case PTV:
                return &FrntPTVInletSection[0];

        case SIMDIST:
                return &FrntSIMDISTInletSection[0];

        case CIS3:
                return &FrntCIS3InletSection[0];

        case CIS4:
                return &FrntCIS4InletSection[0];

        case VOLATILES:
                return &FrntVIInletSection[0];

        case PP:
        case MANUAL_PP:
        case UNKNOWN_INLET:
        default:
                return &FrntPPInletSection[0];
        }
}

static const ML_SECTION_ENTRY * DoBackInletSection()
{
        switch(GetInletType(pBACK_INLET))
        {
        case SS:
        case MANUAL_SS:
                return &BackSSInletSection[0];

        case COC:
        case MANUAL_COC:
                return &BackCOCInletSection[0];

        case PTV:
                return &BackPTVInletSection[0];

        case SIMDIST:
                return &BackSIMDISTInletSection[0];

        case CIS3:
                return &BackCIS3InletSection[0];

        case CIS4:
                return &BackCIS4InletSection[0];

        case VOLATILES:
                return &BackVIInletSection[0];

        case PP:
        case MANUAL_PP:
        case UNKNOWN_INLET:
        default:
                return &BackPPInletSection[0];
        }
}

static const ML_SECTION_ENTRY * DoColumn1Section()
{
        return &Column1Section[0];
}

static const ML_SECTION_ENTRY * DoColumn2Section()
{
        return &Column2Section[0];
}

static const ML_SECTION_ENTRY * DoFrntDetSection()
{
        if (  GetCPFDetPneuPresence(FRONT ) )
        {
             return &FrntCPFDetSection[0];
        }

        switch(GetDetectorType(FRONT))
        {
        case AIB:
                return &FrntDetAIBSection[0];

        case ECD:
                return &FrntDetECDSection[0];

        case FID:
                return  GetElectrometerType(FRONT) ? &FrntDetAIBSection[0] : &FrntDetFIDSection[0];

        case FPD:
                return &FrntDetFPDSection[0];

        case NPD:
                return &FrntDetNPDSection[0];

        case TCD:
                return &FrntDetTCDSection[0];

        case uECD:
                return &FrntDeTuECDSection[0];

        case OEM_AIB:
        case OEM_FID:
                return &FrntDetOEMSection[0];

        default:
                return &FrntDetNotInstalledSection[0];
        }
}

static const ML_SECTION_ENTRY * DoBackDetSection()
{
        if (  GetCPFDetPneuPresence( BACK ) )
        {
             return &BackCPFDetSection[0];
        }

        switch(GetDetectorType(BACK))
        {
        case AIB:
                return &BackDetAIBSection[0];

        case ECD:
                return &BackDetECDSection[0];

        case FID:
                return  GetElectrometerType(BACK) ? &BackDetAIBSection[0] : &BackDetFIDSection[0];

        case FPD:
                return &BackDetFPDSection[0];

        case NPD:
                return &BackDetNPDSection[0];

        case TCD:
                return &BackDetTCDSection[0];

        case uECD:
                return &BackDeTuECDSection[0];

        case OEM_AIB:
        case OEM_FID:
                return &BackDetOEMSection[0];

        default:
                return &BackDetNotInstalledSection[0];
        }
}

static const ML_SECTION_ENTRY * DoSig1Section()
{
        return &Sig1Section[0];
}

static const ML_SECTION_ENTRY * DoSig2Section()
{
        return &Sig2Section[0];
}

static const ML_SECTION_ENTRY * DoColComp1Section()
{
        return &ColComp1Section[0];
}

static const ML_SECTION_ENTRY * DoColComp2Section()
{
        return &ColComp2Section[0];
}

static const ML_SECTION_ENTRY * DoAuxAndRunTableSection()
{
        return &AuxAndRunTableSection[0];
}

static const ML_SECTION_ENTRY * DoValveSection()
{
        return &ValveSection[0];
}

static const ML_SECTION_ENTRY * DoInj1Section()
{
        return &Inj1Section[0];
}

static const ML_SECTION_ENTRY * DoInj2Section()
{
        return &Inj2Section[0];
}

static const ML_SECTION_ENTRY * DoTraySection()
{
        return &TraySection[0];
}

/************************************************************************/

static const ML_PAGE GCPage=
{
        /* left column,                 right column */
        {DoTitleSection,                DoNullSection           },
        {DoOvenSection,                 DoOvenRampSection       },
        {DoFrntInletSection,            DoBackInletSection      },
        {DoColumn1Section,              DoColumn2Section        },
        {DoFrntDetSection,              DoBackDetSection        },
        {DoSig1Section,                 DoSig2Section           },
        {DoColComp1Section,             DoColComp2Section       },
        {DoAuxAndRunTableSection,       DoValveSection          },
        {0,                             0                       }
};

static const ML_PAGE ALSPage=
{
        /* left column,         right column */
        {DoInj1Section,         DoInj2Section   },
        {DoTraySection,         DoNullSection   },
        {0,                     0               }
};

/************************************************************************/

/* MLPad - add whitespace to string so it extends to start of 2nd column */
static void MLPad(BIT8 *s)
{
        size_t len;

        len = strlen((char *)s);

        while ( len < (COL_WIDTH + COL_GAP) )
        {
                *(s + len) = ' ';
                len++;
        }

        *(s + len) = '\0';
}

/***********************************************************************/

/* MLUnPad - delete trailing whitespace from string */
static void MLUnPad(BIT8 *s)
{
        BIT8 *p;

        p = s + strlen((char *)s) - 1;  /* last char in string */

        while ( (p >= s) && (*p == ' ') )
        {
                p--;
        }

        *(p + 1) = '\0';
}

/***********************************************************************/

/* NextSections - advance section pointers, return TRUE if successful */
static BIT8 NextSections(ML_STATE *what)
{
        if ((*what->page)[what->pageIndex].left)
        {
                what->left  = (*what->page)[what->pageIndex].left();
                what->right = (*what->page)[what->pageIndex].right();
                what->pageIndex++;
                what->leftIndex = 0;
                what->rightIndex = 0;
                return TRUE;
        }
        else
        {
                return FALSE;
        }
}

/***********************************************************************/

/* FormatSectionLine - formats a section line, returns TRUE if something was printed */
static BIT8 FormatSectionLine(const ML_SECTION_ENTRY **entry, U_INT8 *index, BIT8 *s)
{
        ML_PRINT_RESULT print;

        /* if there are no entries then return FALSE */
        if (!(*entry)->line)
        {
                return FALSE;
        }

        /* keep executing entries until one prints or we reach the end of the section */
        do
        {
                (*index)++;
                print = (*entry)->line(s, *index, (*entry)->param);

                /* advance to next entry unless return value is "loop" */
                if ( (print != ML_PRINT_LOOP) && (print != ML_NO_PRINT_LOOP) )
                {
                        *index = 0;
                        (*entry)++;
                }
        }
        while ( ((print == ML_NO_PRINT) || (print == ML_NO_PRINT_LOOP)) && (*entry)->line );

        return ( (print == ML_NO_PRINT) || (print == ML_NO_PRINT_LOOP) ) ? FALSE : TRUE;
}

/***********************************************************************/

/* GetListLine - format a method listing line, return TRUE if not EOF */
static INT16 GetListLine(BIT8 *s, ML_STATE *what)
{
        BIT8 Lprint, Rprint;

        /* initialize out string so we can use the C library string functions */
        *s = '\0';

        Lprint = FormatSectionLine(&what->left, &what->leftIndex, s);
        MLPad(s);
        Rprint = FormatSectionLine(&what->right, &what->rightIndex, s + strlen((char *)s));

        if (!Rprint)
        {
                /* strip trailing blanks */
                MLUnPad(s);
        }

        if (Lprint || Rprint)
        {
                /* something was printed, so return its length */
                return strlen((char *)s);
        }
        else
        {
                /* nothing was printed, so see if there are more sections */
                if (NextSections(what))
                {
                        /* there is another section pair, so print it */
                        return GetListLine(s, what);  /* recurse */
                }
                else
                {
                        /* return EOF */
                        return -1;
                }
        }
}

/***********************************************************************/

/* RewindMethodFmt - rewind to beginning of method listing */
void RewindMethodFmt(U_INT16 chan)
{
        GC[chan].page = (ML_PAGE *)GCPage;
        GC[chan].pageIndex = 0;
        (void)NextSections(&GC[chan]);
}

/***********************************************************************/

/* RewindSamplerFmt - rewind to beginning of ALS listing */
void RewindSamplerFmt(U_INT16 chan)
{
        ALS[chan].page = (ML_PAGE *)ALSPage;
        ALS[chan].pageIndex = 0;
        (void)NextSections(&ALS[chan]);
}

/***********************************************************************/

/* ReadMethodFmt - format a method listing line, return length or -1 if EOF */
INT16 ReadMethodFmt(BIT8 *s,U_INT16 chan)
{
        return GetListLine(s, &GC[chan]);
}

/***********************************************************************/

/* ReadSamplerFmt - format an ALS listing line, return length or -1 if EOF */
INT16 ReadSamplerFmt (BIT8 *s,U_INT16 chan)
{
        return GetListLine(s, &ALS[chan]);
}
